Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-12 09:46:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-12 09:46:45 +0400
commit24bf175d7e7c5e659bce623c2a2db270e347dc1e (patch)
tree91dbacc229533c280361b9b822e809c9b069e656 /source/blender/editors/space_node/drawnode.c
parentde86d89a9fd07ecf9d2ab210bdebe7527a3cd817 (diff)
de-duplicate function copy-paste for node color sampling.
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r--source/blender/editors/space_node/drawnode.c205
1 files changed, 0 insertions, 205 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 3f8d9a75244..7d475973c09 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2279,211 +2279,6 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
}
}
-void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4])
-{
- 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];
-
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- /* noisy, high contrast make impossible to read if lower alpha is used. */
- glColor4ub(0, 0, 0, 190);
- glRecti(0.0, 0.0, ar->winrct.xmax - ar->winrct.xmin + 1, 20);
- glDisable(GL_BLEND);
-
- BLF_size(blf_mono_font, 11, 72);
-
- glColor3ub(255, 255, 255);
- BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y);
- // UI_DrawString(6, 6, str); // works ok but fixed width is nicer.
- 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 0 /* XXX no Z value in compo backdrop atm */
- if(zp) {
- glColor3ub(255, 255, 255);
- BLI_snprintf(str, sizeof(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);
- BLI_snprintf(str, sizeof(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);
- }
- #endif
-
- if(channels >= 3) {
- glColor3ubv(red);
- if (fp)
- BLI_snprintf(str, sizeof(str), " R:%-.4f", fp[0]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]);
- else
- BLI_snprintf(str, sizeof(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)
- BLI_snprintf(str, sizeof(str), " G:%-.4f", fp[1]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]);
- else
- BLI_snprintf(str, sizeof(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)
- BLI_snprintf(str, sizeof(str), " B:%-.4f", fp[2]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]);
- else
- BLI_snprintf(str, sizeof(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)
- BLI_snprintf(str, sizeof(str), " A:%-.4f", fp[3]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]);
- else
- BLI_snprintf(str, sizeof(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 */
- if (channels==1) {
- if (fp)
- col[0] = col[1] = col[2] = fp[0];
- else if (cp)
- col[0] = col[1] = col[2] = (float)cp[0]/255.0f;
- else
- col[0] = col[1] = col[2] = 0.0f;
- }
- else if (channels==3) {
- if (fp)
- copy_v3_v3(col, fp);
- else if (cp) {
- col[0] = (float)cp[0]/255.0f;
- col[1] = (float)cp[1]/255.0f;
- col[2] = (float)cp[2]/255.0f;
- }
- else
- zero_v3(col);
- }
- else if (channels==4) {
- if (fp)
- copy_v4_v4(col, fp);
- else if (cp) {
- col[0] = (float)cp[0]/255.0f;
- col[1] = (float)cp[1]/255.0f;
- col[2] = (float)cp[2]/255.0f;
- col[3] = (float)cp[3]/255.0f;
- }
- else
- zero_v4(col);
- }
- if (color_manage) {
- linearrgb_to_srgb_v3_v3(finalcol, col);
- finalcol[3] = col[3];
- }
- else {
- copy_v4_v4(finalcol, col);
- }
- 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;
-
- glColor3ub(255, 255, 255);
- if(channels == 1) {
- if (fp) {
- rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
- rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v);
- }
- else if (cp) {
- rgb_to_hsv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &hue, &sat, &val);
- rgb_to_yuv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &lum, &u, &v);
- }
-
- BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
- BLF_position(blf_mono_font, dx, 6, 0);
- BLF_draw_ascii(blf_mono_font, str, sizeof(str));
- dx += BLF_width(blf_mono_font, str);
-
- BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
- BLF_position(blf_mono_font, dx, 6, 0);
- BLF_draw_ascii(blf_mono_font, str, sizeof(str));
- dx += BLF_width(blf_mono_font, str);
- }
- else if(channels >= 3) {
- if (fp) {
- rgb_to_hsv(fp[0], fp[1], fp[2], &hue, &sat, &val);
- rgb_to_yuv(fp[0], fp[1], fp[2], &lum, &u, &v);
- }
- else if (cp) {
- rgb_to_hsv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &hue, &sat, &val);
- rgb_to_yuv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &lum, &u, &v);
- }
-
- BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
- BLF_position(blf_mono_font, dx, 6, 0);
- BLF_draw_ascii(blf_mono_font, str, sizeof(str));
- dx += BLF_width(blf_mono_font, str);
-
- BLI_snprintf(str, sizeof(str), " S:%-.4f", sat);
- BLF_position(blf_mono_font, dx, 6, 0);
- BLF_draw_ascii(blf_mono_font, str, sizeof(str));
- dx += BLF_width(blf_mono_font, str);
-
- BLI_snprintf(str, sizeof(str), " V:%-.4f", val);
- BLF_position(blf_mono_font, dx, 6, 0);
- BLF_draw_ascii(blf_mono_font, str, sizeof(str));
- dx += BLF_width(blf_mono_font, str);
-
- BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
- BLF_position(blf_mono_font, dx, 6, 0);
- BLF_draw_ascii(blf_mono_font, str, sizeof(str));
- dx += BLF_width(blf_mono_font, str);
- }
-
- (void)dx;
-}
-
#if 0
/* note: needs to be userpref or opengl profile option */
static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)