Procházet zdrojové kódy

Fix MCIR & Temperature

Also improve land color in MCIR images
tags/v1.8.0
Xerbo před 4 roky
rodič
revize
175a76054e
2 změnil soubory, kde provedl 11 přidání a 9 odebrání
  1. +3
    -3
      main.c
  2. +8
    -6
      pngio.c

+ 3
- 3
main.c Zobrazit soubor

@@ -148,7 +148,7 @@ static int processAudio(char *filename, options_t *opts){

if(strcmp(extension, "png") == 0){
// Read PNG into image buffer
printf("Reading %s", filename);
printf("Reading %s\n", filename);
if(readRawImage(filename, img.prow, &img.nrow) == 0){
fprintf(stderr, "Skipping %s; see above.\n", img.name);
return 0;
@@ -180,7 +180,7 @@ static int processAudio(char *filename, options_t *opts){

if(opts->realtime) closeWriter();

printf("\nTotal rows: %d\n", img.nrow);
printf("Total rows: %d\n", img.nrow);

// Fallback for detecting the zenith
// TODO: encode zenith in raw images
@@ -215,7 +215,7 @@ static int processAudio(char *filename, options_t *opts){

// MCIR
if (CONTAINS(opts->type, 'm'))
ImageOut(opts, &img, 0, IMG_WIDTH, "MCIR", "m", NULL);
ImageOut(opts, &img, CHA_OFFSET, CH_WIDTH, "MCIR", "m", NULL);

// Linear equalise
if(CONTAINS(opts->effects, 'l')){


+ 8
- 6
pngio.c Zobrazit soubor

@@ -75,6 +75,8 @@ int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR) {
fclose(fp);
png_destroy_read_struct(&png, &info, NULL);

printf("Adding map overlay\n");

// Map overlay / MCIR / Precipitation
int mapOffset = (height/2)-zenith;
for(int y = 0; y < nrow; y++) {
@@ -96,8 +98,8 @@ int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR) {
if(map.b < 128 && map.g > 128){
// Land
float green = CLIP((map.g-256)/32.0, 0, 1);
float blue = 1-CLIP((map.b-32)/64.0, 0, 1);
crow[y][cha] = (rgb_t){50 + blue*50, 80 + green*70, 64};
float blue = 1 - CLIP((map.b-32)/64.0, 0, 1);
crow[y][cha] = (rgb_t){blue*127, 30+green*80, 40};
}else{
// Sea
crow[y][cha] = (rgb_t){12, 30, 85};
@@ -275,7 +277,7 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c

// Map stuff
if(opts->map != NULL && opts->map[0] != '\0'){
if(mapOverlay(opts->map, crow, img->nrow, zenith, strcmp(chid, "MCIR") == 0) == 0){
if(mapOverlay(opts->map, crow, img->nrow, zenith, strcmp(desc, "MCIR") == 0) == 0){
fprintf(stderr, "Skipping MCIR generation; see above.\n");
return 0;
}
@@ -314,9 +316,9 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
};
}else{
pix[x] = (png_color){
CLIP(crow[y][x + skip + offset].r, 0, 255),
CLIP(crow[y][x + skip + offset].g, 0, 255),
CLIP(crow[y][x + skip + offset].b, 0, 255)
crow[y][x + skip + offset].r,
crow[y][x + skip + offset].g,
crow[y][x + skip + offset].b
};
}
}


Načítá se…
Zrušit
Uložit