[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30301] trunk/blender/source/blender/ editors/interface/interface_regions.c: [#22830] Hex colour number ( COLOUR BALANCE) is out the range in video strip

Campbell Barton ideasman42 at gmail.com
Wed Jul 14 10:39:59 CEST 2010


Revision: 30301
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30301
Author:   campbellbarton
Date:     2010-07-14 10:39:59 +0200 (Wed, 14 Jul 2010)

Log Message:
-----------
[#22830] Hex colour number (COLOUR BALANCE) is out the range in video strip
- use FTOCHAR macro which clamps values above 1.0 (rather then wrapping)
- also fixes a problem rounding down where white would display as FEFEFE rather then FFFFFF

the report also mentions how editing colors above 255 is broken but think this isnt worth trying to support. 

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_regions.c

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2010-07-14 08:29:16 UTC (rev 30300)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2010-07-14 08:39:59 UTC (rev 30301)
@@ -1600,7 +1600,7 @@
 			if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart);
 			if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart);
 
-			sprintf(col, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0));
+			sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
 			
 			strcpy(bt->poin, col);
 		}
@@ -1861,9 +1861,9 @@
 	}
 
 	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-	
-	sprintf(hexcol, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0));	
 
+	sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
+
 	bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
 	uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
 	uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");





More information about the Bf-blender-cvs mailing list