Index: source/blender/imbuf/IMB_imbuf.h =================================================================== --- source/blender/imbuf/IMB_imbuf.h (revision 43045) +++ source/blender/imbuf/IMB_imbuf.h (working copy) @@ -73,7 +73,7 @@ /** * - * @attention defined in ??? + * @attention defined in IMB_imbuf_types.h */ struct ImBuf; Index: source/blender/editors/space_image/image_draw.c =================================================================== --- source/blender/editors/space_image/image_draw.c (revision 43045) +++ source/blender/editors/space_image/image_draw.c (working copy) @@ -110,21 +110,15 @@ BKE_image_release_renderresult(scene, ima); } -void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf) +void draw_image_info(ARegion *ar, short color_profile, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf) { char str[256]; float dx= 6; /* text colors */ - /* XXX colored text not allowed in Blender UI */ - #if 0 unsigned char red[3] = {255, 50, 50}; unsigned char green[3] = {0, 255, 0}; unsigned char blue[3] = {100, 100, 255}; - #else - unsigned char red[3] = {255, 255, 255}; - unsigned char green[3] = {255, 255, 255}; - unsigned char blue[3] = {255, 255, 255}; - #endif + float hue=0, sat=0, val=0, lum=0, u=0, v=0; float col[4], finalcol[4]; @@ -138,77 +132,67 @@ BLF_size(blf_mono_font, 11, 72); + /* Bit Depth and Color Space Information */ glColor3ub(255, 255, 255); - sprintf(str, "X:%-4d Y:%-4d |", x, y); - // UI_DrawString(6, 6, str); // works ok but fixed width is nicer. + sprintf(str, "D: "); + if (fp) + strcat(str, "32bpc"); + else if (cp) + strcat(str, "8bpc"); + else + strcat(str, "Other"); + + strcat(str, " "); + strcat(str, "CS: "); + + // This will become proper color space strings with OCIO + switch (color_profile) { + case (IB_PROFILE_NONE): + strcat(str, "None"); + break; + case (IB_PROFILE_LINEAR_RGB): + strcat(str, "Linear"); + break; + case (IB_PROFILE_SRGB): + strcat(str, "sRGB"); + break; + case (IB_PROFILE_CUSTOM): + strcat(str, "Custom"); + break; + default: + strcat(str, "Unknown"); + break; + } + + strcat(str, " | "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); + + /* X Y Z Information */ + glColor3ub(255, 255, 255); + sprintf(str, "X:%-5d Y:%-5d", x, y); + strcat(str, " | "); + BLF_position(blf_mono_font, dx, 6, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str); - if(zp) { - glColor3ub(255, 255, 255); - sprintf(str, " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff)); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - if(zpf) { - glColor3ub(255, 255, 255); - sprintf(str, " Z:%-.3f |", *zpf); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } + if (zp || zpf) { + if(zp) { + glColor3ub(255, 255, 255); + sprintf(str, "Z:%-.5f", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff)); + } + if(zpf) { + glColor3ub(255, 255, 255); + sprintf(str, "Z:%-.5f", *zpf); + } + strcat(str, " | "); + } + BLF_position(blf_mono_font, dx, 6, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str); - if(channels >= 3) { - glColor3ubv(red); - if (fp) - sprintf(str, " R:%-.4f", fp[0]); - else if (cp) - sprintf(str, " R:%-3d", cp[0]); - else - sprintf(str, " R:-"); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - glColor3ubv(green); - if (fp) - sprintf(str, " G:%-.4f", fp[1]); - else if (cp) - sprintf(str, " G:%-3d", cp[1]); - else - sprintf(str, " G:-"); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - glColor3ubv(blue); - if (fp) - sprintf(str, " B:%-.4f", fp[2]); - else if (cp) - sprintf(str, " B:%-3d", cp[2]); - else - sprintf(str, " B:-"); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - if(channels == 4) { - glColor3ub(255, 255, 255); - if (fp) - sprintf(str, " A:%-.4f", fp[3]); - else if (cp) - sprintf(str, " A:%-3d", cp[3]); - else - sprintf(str, "- "); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - } - - /* color rectangle */ + /* Color Swatch */ if (channels==1) { if (fp) col[0] = col[1] = col[2] = fp[0]; @@ -240,7 +224,8 @@ else zero_v4(col); } - if (color_manage) { + + if (color_profile == IB_PROFILE_LINEAR_RGB) { linearrgb_to_srgb_v3_v3(finalcol, col); finalcol[3] = col[3]; } @@ -249,15 +234,68 @@ } glDisable(GL_BLEND); glColor3fv(finalcol); - dx += 5; glBegin(GL_QUADS); glVertex2f(dx, 3); glVertex2f(dx, 17); glVertex2f(dx+30, 17); glVertex2f(dx+30, 3); glEnd(); - dx += 35; + dx += 30 + BLF_width(blf_mono_font, " "); + + /* R G B Information */ + if(channels >= 3) { + glColor3ubv(red); + if (fp) + sprintf(str, "R:%-.5f", fp[0]); + else if (cp) + sprintf(str, "R:%-5d", cp[0]); + else + sprintf(str, "R:-"); + strcat(str, " "); + BLF_position(blf_mono_font, dx, 6, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str); + + glColor3ubv(green); + if (fp) + sprintf(str, "G:%-.5f", fp[1]); + else if (cp) + sprintf(str, "G:%-5d", cp[1]); + else + sprintf(str, "G:-"); + strcat(str, " "); + BLF_position(blf_mono_font, dx, 6, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str); + + glColor3ubv(blue); + if (fp) + sprintf(str, "B:%-.5f", fp[2]); + else if (cp) + sprintf(str, "B:%-5d", cp[2]); + else + sprintf(str, "B:-"); + strcat(str, " "); + BLF_position(blf_mono_font, dx, 6, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str); + + if(channels == 4) { + glColor3ub(255, 255, 255); + if (fp) + sprintf(str, "A:%-.5f", fp[3]); + else if (cp) + sprintf(str, "A:%-5d", cp[3]); + else + sprintf(str, "-"); + strcat(str, " "); + BLF_position(blf_mono_font, dx, 6, 0); + BLF_draw_ascii(blf_mono_font, str, sizeof(str)); + dx += BLF_width(blf_mono_font, str); + } + } + /* H S V Information */ glColor3ub(255, 255, 255); if(channels == 1) { if (fp) { @@ -269,12 +307,14 @@ rgb_to_yuv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &lum, &u, &v); } - sprintf(str, "V:%-.4f", val); + sprintf(str, "V:%-.5f", val); + strcat(str, " "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); - sprintf(str, " L:%-.4f", lum); + sprintf(str, "L:%-.5f", lum); + strcat(str, " "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); @@ -289,22 +329,26 @@ rgb_to_yuv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &lum, &u, &v); } - sprintf(str, "H:%-.4f", hue); + sprintf(str, "H:%-.5f", hue); + strcat(str, " "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); - sprintf(str, " S:%-.4f", sat); + sprintf(str, "S:%-.5f", sat); + strcat(str, " "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); - sprintf(str, " V:%-.4f", val); + sprintf(str, "V:%-.5f", val); + strcat(str, " "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); - sprintf(str, " L:%-.4f", lum); + sprintf(str, "L:%-.5f", lum); + strcat(str, " "); BLF_position(blf_mono_font, dx, 6, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); Index: source/blender/editors/space_image/image_ops.c =================================================================== --- source/blender/editors/space_image/image_ops.c (revision 43045) +++ source/blender/editors/space_image/image_ops.c (working copy) @@ -1763,7 +1763,9 @@ float *colfp; int *zp; float *zfp; - + + short profile; + int draw; } ImageSampleInfo; @@ -1771,8 +1773,7 @@ { ImageSampleInfo *info= arg_info; if(info->draw) { - /* no color management needed for images (color_manage=0) */ - draw_image_info(ar, 0, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); + draw_image_info(ar, info->profile, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); } } @@ -1804,6 +1805,7 @@ info->y= y; info->draw= 1; info->channels= ibuf->channels; + info->profile= ibuf->profile; info->colp= NULL; info->colfp= NULL; @@ -1818,12 +1820,6 @@ info->col[2]= cp[2]; info->col[3]= cp[3]; info->colp= info->col; - - info->colf[0]= (float)cp[0]/255.0f; - info->colf[1]= (float)cp[1]/255.0f; - info->colf[2]= (float)cp[2]/255.0f; - info->colf[3]= (float)cp[3]/255.0f; - info->colfp= info->colf; } if(ibuf->rect_float) { fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x)); Index: source/blender/editors/space_image/image_intern.h =================================================================== --- source/blender/editors/space_image/image_intern.h (revision 43045) +++ source/blender/editors/space_image/image_intern.h (working copy) @@ -55,7 +55,7 @@ /* image_draw.c */ void draw_image_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene); -void draw_image_info(struct ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf); +void draw_image_info(struct ARegion *ar, short color_profile, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf); void draw_image_grease_pencil(struct bContext *C, short onlyv2d); /* image_ops.c */