diff --git a/src/drawentity.cpp b/src/drawentity.cpp index c7c67aa..8879290 100644 --- a/src/drawentity.cpp +++ b/src/drawentity.cpp @@ -520,11 +520,11 @@ void Entity::DrawOrGetDistance(void) { // dimmer for the ones at the model origin. int f = (i == 0 ? 100 : 255); if(hr.v == Request::HREQUEST_REFERENCE_XY.v) { - ssglColorRGB(RGB(0, 0, f)); + ssglColorRGB(RGBi(0, 0, f)); } else if(hr.v == Request::HREQUEST_REFERENCE_YZ.v) { - ssglColorRGB(RGB(f, 0, 0)); + ssglColorRGB(RGBi(f, 0, 0)); } else if(hr.v == Request::HREQUEST_REFERENCE_ZX.v) { - ssglColorRGB(RGB(0, f, 0)); + ssglColorRGB(RGBi(0, f, 0)); } else { ssglColorRGB(Style::Color(Style::NORMALS)); if(i > 0) break; diff --git a/src/dsc.h b/src/dsc.h index ed0fe19..b859845 100644 --- a/src/dsc.h +++ b/src/dsc.h @@ -395,8 +395,7 @@ public: void Solve(void); }; -#undef RGB -#define RGB(r, g, b) RgbColor::From((r), (g), (b)) +#define RGBi(r, g, b) RgbColor::From((r), (g), (b)) #define RGBf(r, g, b) RgbColor::FromFloat((float)(r), (float)(g), (float)(b)) #define NULL_COLOR RgbColor::Default() diff --git a/src/glhelper.cpp b/src/glhelper.cpp index 830882a..52aab0f 100644 --- a/src/glhelper.cpp +++ b/src/glhelper.cpp @@ -371,13 +371,13 @@ void ssglDebugPolygon(SPolygon *p) Vector a = (sc->l.elem[j]).p; Vector b = (sc->l.elem[j+1]).p; - ssglLockColorTo(RGB(0, 0, 255)); + ssglLockColorTo(RGBi(0, 0, 255)); Vector d = (a.Minus(b)).WithMagnitude(-0); glBegin(GL_LINES); ssglVertex3v(a.Plus(d)); ssglVertex3v(b.Minus(d)); glEnd(); - ssglLockColorTo(RGB(255, 0, 0)); + ssglLockColorTo(RGBi(255, 0, 0)); glBegin(GL_POINTS); ssglVertex3v(a.Plus(d)); ssglVertex3v(b.Minus(d)); @@ -415,7 +415,7 @@ void ssglDebugMesh(SMesh *m) ssglDepthRangeOffset(1); ssglUnlockColor(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - ssglColorRGBa(RGB(0, 255, 0), 1.0); + ssglColorRGBa(RGBi(0, 255, 0), 1.0); glBegin(GL_TRIANGLES); for(i = 0; i < m->l.n; i++) { STriangle *t = &(m->l.elem[i]); diff --git a/src/group.cpp b/src/group.cpp index cf6a0d7..2527d2f 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -55,7 +55,7 @@ void Group::MenuGroup(int id) { Group g; ZERO(&g); g.visible = true; - g.color = RGB(100, 100, 100); + g.color = RGBi(100, 100, 100); g.scale = 1; if(id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT)) { diff --git a/src/solvespace.cpp b/src/solvespace.cpp index e035239..78caa55 100644 --- a/src/solvespace.cpp +++ b/src/solvespace.cpp @@ -15,14 +15,14 @@ void SolveSpace::Init(char *cmdLine) { // Then, load the registry settings. int i; // Default list of colors for the model material - modelColor[0] = CnfThawColor(RGB(150, 150, 150), "ModelColor_0"); - modelColor[1] = CnfThawColor(RGB(100, 100, 100), "ModelColor_1"); - modelColor[2] = CnfThawColor(RGB( 30, 30, 30), "ModelColor_2"); - modelColor[3] = CnfThawColor(RGB(150, 0, 0), "ModelColor_3"); - modelColor[4] = CnfThawColor(RGB( 0, 100, 0), "ModelColor_4"); - modelColor[5] = CnfThawColor(RGB( 0, 80, 80), "ModelColor_5"); - modelColor[6] = CnfThawColor(RGB( 0, 0, 130), "ModelColor_6"); - modelColor[7] = CnfThawColor(RGB( 80, 0, 80), "ModelColor_7"); + modelColor[0] = CnfThawColor(RGBi(150, 150, 150), "ModelColor_0"); + modelColor[1] = CnfThawColor(RGBi(100, 100, 100), "ModelColor_1"); + modelColor[2] = CnfThawColor(RGBi( 30, 30, 30), "ModelColor_2"); + modelColor[3] = CnfThawColor(RGBi(150, 0, 0), "ModelColor_3"); + modelColor[4] = CnfThawColor(RGBi( 0, 100, 0), "ModelColor_4"); + modelColor[5] = CnfThawColor(RGBi( 0, 80, 80), "ModelColor_5"); + modelColor[6] = CnfThawColor(RGBi( 0, 0, 130), "ModelColor_6"); + modelColor[7] = CnfThawColor(RGBi( 80, 0, 80), "ModelColor_7"); // Light intensities lightIntensity[0] = CnfThawFloat(1.0f, "LightIntensity_0"); lightIntensity[1] = CnfThawFloat(0.5f, "LightIntensity_1"); @@ -62,7 +62,7 @@ void SolveSpace::Init(char *cmdLine) { // Export pwl curves (instead of exact) always exportPwlCurves = CnfThawBool(false, "ExportPwlCurves"); // Background color on-screen - backgroundColor = CnfThawColor(RGB(0, 0, 0), "BackgroundColor"); + backgroundColor = CnfThawColor(RGBi(0, 0, 0), "BackgroundColor"); // Whether export canvas size is fixed or derived from bbox exportCanvasSizeAuto = CnfThawBool(true, "ExportCanvasSizeAuto"); // Margins for automatic canvas size diff --git a/src/style.cpp b/src/style.cpp index d091fac..3a69374 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -113,7 +113,7 @@ void Style::LoadFactoryDefaults(void) { s->fillColor = RGBf(0.3, 0.3, 0.3); s->name.strcpy(CnfPrefixToName(d->cnfPrefix)); } - SS.backgroundColor = RGB(0, 0, 0); + SS.backgroundColor = RGBi(0, 0, 0); if(SS.bgImage.fromFile) MemFree(SS.bgImage.fromFile); SS.bgImage.fromFile = NULL; } @@ -218,7 +218,7 @@ RgbColor Style::RewriteColor(RgbColor rgbin) { // good for the default on-screen view (black bg) but probably // not desired in the exported files, which typically are shown // against white backgrounds. - return RGB(0, 0, 0); + return RGBi(0, 0, 0); } else { return rgbin; } diff --git a/src/textwin.cpp b/src/textwin.cpp index 513d35f..f6a97df 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -7,24 +7,24 @@ #include const TextWindow::Color TextWindow::fgColors[] = { - { 'd', RGB(255, 255, 255) }, - { 'l', RGB(100, 100, 255) }, - { 't', RGB(255, 200, 0) }, - { 'h', RGB( 90, 90, 90) }, - { 's', RGB( 40, 255, 40) }, - { 'm', RGB(200, 200, 0) }, - { 'r', RGB( 0, 0, 0) }, - { 'x', RGB(255, 20, 20) }, - { 'i', RGB( 0, 255, 255) }, - { 'g', RGB(160, 160, 160) }, - { 'b', RGB(200, 200, 200) }, + { 'd', RGBi(255, 255, 255) }, + { 'l', RGBi(100, 100, 255) }, + { 't', RGBi(255, 200, 0) }, + { 'h', RGBi( 90, 90, 90) }, + { 's', RGBi( 40, 255, 40) }, + { 'm', RGBi(200, 200, 0) }, + { 'r', RGBi( 0, 0, 0) }, + { 'x', RGBi(255, 20, 20) }, + { 'i', RGBi( 0, 255, 255) }, + { 'g', RGBi(160, 160, 160) }, + { 'b', RGBi(200, 200, 200) }, { 0, NULL_COLOR } }; const TextWindow::Color TextWindow::bgColors[] = { - { 'd', RGB( 0, 0, 0) }, - { 't', RGB( 34, 15, 15) }, - { 'a', RGB( 25, 25, 25) }, - { 'r', RGB(255, 255, 255) }, + { 'd', RGBi( 0, 0, 0) }, + { 't', RGBi( 34, 15, 15) }, + { 'a', RGBi( 25, 25, 25) }, + { 'r', RGBi(255, 255, 255) }, { 0, NULL_COLOR } }; @@ -558,20 +558,20 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown, if(how == CLICK || (how == HOVER && leftDown)) InvalidateText(); static const RgbColor BaseColor[12] = { - RGB(255, 0, 0), - RGB( 0, 255, 0), - RGB( 0, 0, 255), + RGBi(255, 0, 0), + RGBi( 0, 255, 0), + RGBi( 0, 0, 255), - RGB( 0, 255, 255), - RGB(255, 0, 255), - RGB(255, 255, 0), + RGBi( 0, 255, 255), + RGBi(255, 0, 255), + RGBi(255, 255, 0), - RGB(255, 127, 0), - RGB(255, 0, 127), - RGB( 0, 255, 127), - RGB(127, 255, 0), - RGB(127, 0, 255), - RGB( 0, 127, 255), + RGBi(255, 127, 0), + RGBi(255, 0, 127), + RGBi( 0, 255, 127), + RGBi(127, 255, 0), + RGBi(127, 0, 255), + RGBi( 0, 127, 255), }; int width, height; diff --git a/src/win32/w32main.cpp b/src/win32/w32main.cpp index 50b046f..af69b81 100644 --- a/src/win32/w32main.cpp +++ b/src/win32/w32main.cpp @@ -8,12 +8,6 @@ #include "solvespace.h" #include #include -// we define RGB() to return our RgbColor, but that conflicts with Win32's -// definition; so put that back like Windows expects -#undef RGB -#define RGB(r,g,b) \ - ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) - #include #include