From 175a76054ed801da9a0b5d9f71a19aa185a088bf Mon Sep 17 00:00:00 2001 From: Xerbo Date: Tue, 11 Feb 2020 20:34:58 +0000 Subject: [PATCH] Fix MCIR & Temperature Also improve land color in MCIR images --- main.c | 6 +++--- pngio.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index d7537d9..47a36d5 100644 --- a/main.c +++ b/main.c @@ -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')){ diff --git a/pngio.c b/pngio.c index bf1cd9e..9de24c6 100644 --- a/pngio.c +++ b/pngio.c @@ -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 }; } }