use icons for rgb colors

This commit is contained in:
Campbell Barton 2012-07-06 11:24:43 +00:00
parent f058a3dd42
commit 27da686aec
2 changed files with 16 additions and 11 deletions

@ -2954,13 +2954,15 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) {
int ofs;
#ifdef __BIG_ENDIAN__
if (snode->flag & SNODE_SHOW_R) ofs = 2;
else if (snode->flag & SNODE_SHOW_G) ofs = 1;
else ofs = 0;
#else
if (snode->flag & SNODE_SHOW_R) ofs = 1;
else if (snode->flag & SNODE_SHOW_G) ofs = 2;
else ofs = 3;
if (ENDIAN_ORDER == B_ENDIAN) {
ofs = 3 - ofs;
}
#endif
glPixelZoom(snode->zoom, snode->zoom);
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
@ -2972,12 +2974,14 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
else if (snode->flag & SNODE_SHOW_ALPHA) {
glPixelZoom(snode->zoom, snode->zoom);
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
if (ENDIAN_ORDER == B_ENDIAN)
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
#ifdef __BIG_ENDIAN__
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
#endif
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
#ifdef __BIG_ENDIAN__
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
#endif
glPixelZoom(1.0f, 1.0f);
}
else if (snode->flag & SNODE_USE_ALPHA) {

@ -2852,9 +2852,10 @@ static void rna_def_space_node(BlenderRNA *brna)
{SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
"Draw image with RGB colors and alpha transparency"},
{SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
{SNODE_SHOW_R, "RED", 0, "Red", ""},
{SNODE_SHOW_G, "GREEN", 0, "Green", ""},
{SNODE_SHOW_B, "BLUE", 0, "Blue", ""},
/* XXX, we could use better icons here */
{SNODE_SHOW_R, "RED", ICON_COLOR, "Red", ""},
{SNODE_SHOW_G, "GREEN", ICON_COLOR, "Green", ""},
{SNODE_SHOW_B, "BLUE", ICON_COLOR, "Blue", ""},
{0, NULL, 0, NULL, NULL}
};