From 559adb0959088cc37a68b7b43bfe0579f7bee4da Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 20 Feb 2009 17:31:13 +0000 Subject: [PATCH] 2009-02-20 18:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/gtxwc/gtxwc.c * harbour/source/rtl/gttrm/gttrm.c * reverted the RGB numeric color definition to be compatible with Windows GTs which seems to use RGB values directly. Users who use to define RGB colors in hex notation (0xRRGGBB) should now remember that it's BGR definition (0xBBGGRR). Why MS have to make everything in reverted way? --- harbour/ChangeLog | 9 +++++++++ harbour/source/rtl/gttrm/gttrm.c | 4 ++-- harbour/source/rtl/gtxwc/gtxwc.c | 20 ++++++++++---------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 68c7c6a934..9e79963a70 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,15 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-20 18:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/gtxwc/gtxwc.c + * harbour/source/rtl/gttrm/gttrm.c + * reverted the RGB numeric color definition to be compatible + with Windows GTs which seems to use RGB values directly. + Users who use to define RGB colors in hex notation (0xRRGGBB) + should now remember that it's BGR definition (0xBBGGRR). + Why MS have to make everything in reverted way? + 2009-02-20 15:47 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * bin/hb-func.sh ! Two typos. diff --git a/harbour/source/rtl/gttrm/gttrm.c b/harbour/source/rtl/gttrm/gttrm.c index a8647538fa..b92ef3b182 100644 --- a/harbour/source/rtl/gttrm/gttrm.c +++ b/harbour/source/rtl/gttrm/gttrm.c @@ -1573,9 +1573,9 @@ static void hb_gt_trm_LinuxSetPalette( PHB_GTTRM pTerm, int iIndex ) int iAnsiIndex = s_AnsiColors[ iIndex & 0x07 ] | ( iIndex & 0x08 ); hb_snprintf( szColor, sizeof( szColor ), "\033]P%X%02X%02X%02X", iAnsiIndex, - ( pTerm->colors[ iIndex ] >> 16 ) & 0xff, + ( pTerm->colors[ iIndex ] ) & 0xff, ( pTerm->colors[ iIndex ] >> 8 ) & 0xff, - ( pTerm->colors[ iIndex ] ) & 0xff ); + ( pTerm->colors[ iIndex ] >> 16 ) & 0xff ); hb_gt_trm_termOut( pTerm, ( BYTE * ) szColor, 10 ); } } diff --git a/harbour/source/rtl/gtxwc/gtxwc.c b/harbour/source/rtl/gtxwc/gtxwc.c index 5ec26d6ed4..222354baa6 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.c +++ b/harbour/source/rtl/gtxwc/gtxwc.c @@ -283,20 +283,20 @@ static const UnixBoxChar boxTranslate[] ={ /* these are standard PC console colors in RGB */ static const int rgb_values[] = { 0x000000, /* black "rgb:00/00/00" */ - 0x0000AA, /* blue "rgb:00/00/AA" */ + 0xAA0000, /* blue "rgb:00/00/AA" */ 0x00AA00, /* green "rgb:00/AA/00" */ - 0x00AAAA, /* cyan "rgb:00/AA/AA" */ - 0xAA0000, /* red "rgb:AA/00/00" */ + 0xAAAA00, /* cyan "rgb:00/AA/AA" */ + 0x0000AA, /* red "rgb:AA/00/00" */ 0xAA00AA, /* magenta "rgb:AA/00/AA" */ - 0xAA5500, /* brown "rgb:AA/55/00" */ + 0x0055AA, /* brown "rgb:AA/55/00" */ 0xAAAAAA, /* light gray "rgb:AA/AA/AA" */ 0x555555, /* gray "rgb:55/55/55" */ - 0x5555FF, /* light blue "rgb:55/55/FF" */ + 0xFF5555, /* light blue "rgb:55/55/FF" */ 0x55FF55, /* light green "rgb:55/FF/55" */ - 0x55FFFF, /* light cyan "rgb:55/FF/FF" */ - 0xFF5555, /* light red "rgb:FF/55/55" */ + 0xFFFF55, /* light cyan "rgb:55/FF/FF" */ + 0x5555FF, /* light red "rgb:FF/55/55" */ 0xFF55FF, /* light magenta "rgb:FF/55/FF" */ - 0xFFFF55, /* yellow "rgb:FF/FF/55" */ + 0x55FFFF, /* yellow "rgb:FF/FF/55" */ 0xFFFFFF /* white "rgb:FF/FF/FF" */ }; @@ -2474,9 +2474,9 @@ static BOOL hb_gt_xwc_setPalette( PXWND_DEF wnd ) XFreeColors( wnd->dpy, wnd->colorsmap, &wnd->colors[i].pixel, 1, 0 ); hb_snprintf( rgb_color, sizeof( rgb_color ), "rgb:%02X/%02X/%02X", - ( wnd->colors[i].value >> 16 ) & 0xFF, + ( wnd->colors[i].value ) & 0xFF, ( wnd->colors[i].value >> 8 ) & 0xFF, - ( wnd->colors[i].value ) & 0xFF ); + ( wnd->colors[i].value >> 16 ) & 0xFF ); if( XLookupColor( wnd->dpy, wnd->colorsmap, rgb_color, &dummy, &color ) != 0 ) { if( hb_gt_xwc_AllocColor( wnd, &color ) )