| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 75a3936 commit 5e7c7fc
17 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,7 @@ void GraphicsWindow::Selection::Draw(void) { | |||
| 61 | 61 | topLeft = topLeft.Minus(SS.GW.offset); | |
| 62 | 62 | ||
| 63 | 63 | ssglLineWidth(40); | |
| 64 | - RgbColor rgb = Style::Color(Style::HOVERED); | ||
| 64 | + RgbaColor rgb = Style::Color(Style::HOVERED); | ||
| 65 | 65 | glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), 0.2); | |
| 66 | 66 | glBegin(GL_LINES); | |
| 67 | 67 | ssglVertex3v(topLeft); | |
@@ -517,7 +517,7 @@ void GraphicsWindow::Paint(void) { | |||
| 517 | 517 | SS.backgroundColor.blueF(), 1.0f); | |
| 518 | 518 | } else { | |
| 519 | 519 | // Draw a different background whenever we're having solve problems. | |
| 520 | - RgbColor rgb = Style::Color(Style::DRAW_ERROR); | ||
| 520 | + RgbaColor rgb = Style::Color(Style::DRAW_ERROR); | ||
| 521 | 521 | glClearColor(0.4f*rgb.redF(), 0.4f*rgb.greenF(), 0.4f*rgb.blueF(), 1.0f); | |
| 522 | 522 | // And show the text window, which has info to debug it | |
| 523 | 523 | ForceTextWindowShown(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -570,7 +570,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { | |||
| 570 | 570 | // Let's adjust the color of this constraint to have the same | |
| 571 | 571 | // rough luma as the point color, so that the constraint does not | |
| 572 | 572 | // stand out in an ugly way. | |
| 573 | - RgbColor cd = Style::Color(Style::DATUM), | ||
| 573 | + RgbaColor cd = Style::Color(Style::DATUM), | ||
| 574 | 574 | cc = Style::Color(Style::CONSTRAINT); | |
| 575 | 575 | // convert from 8-bit color to a vector | |
| 576 | 576 | Vector vd = Vector::From(cd.redF(), cd.greenF(), cd.blueF()), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -397,12 +397,12 @@ class BandedMatrix { | |||
| 397 | 397 | void Solve(void); | |
| 398 | 398 | }; | |
| 399 | 399 | ||
| 400 | - #define RGBi(r, g, b) RgbColor::From((r), (g), (b)) | ||
| 401 | - #define RGBf(r, g, b) RgbColor::FromFloat((float)(r), (float)(g), (float)(b)) | ||
| 400 | + #define RGBi(r, g, b) RgbaColor::From((r), (g), (b)) | ||
| 401 | + #define RGBf(r, g, b) RgbaColor::FromFloat((float)(r), (float)(g), (float)(b)) | ||
| 402 | 402 | ||
| 403 | - // Note: sizeof(class RgbColor) should be exactly 4 | ||
| 403 | + // Note: sizeof(class RgbaColor) should be exactly 4 | ||
| 404 | 404 | // | |
| 405 | - class RgbColor { | ||
| 405 | + class RgbaColor { | ||
| 406 | 406 | public: | |
| 407 | 407 | uint8_t red, green, blue, alpha; | |
| 408 | 408 | ||
@@ -411,7 +411,7 @@ class RgbColor { | |||
| 411 | 411 | float blueF(void) const { return (float)blue / 255.0f; } | |
| 412 | 412 | float alphaF(void) const { return (float)alpha / 255.0f; } | |
| 413 | 413 | ||
| 414 | - bool Equals(RgbColor c) const { | ||
| 414 | + bool Equals(RgbaColor c) const { | ||
| 415 | 415 | return | |
| 416 | 416 | c.red == red && | |
| 417 | 417 | c.green == green && | |
@@ -427,24 +427,24 @@ class RgbColor { | |||
| 427 | 427 | (uint32_t)((255 - alpha) << 24); | |
| 428 | 428 | } | |
| 429 | 429 | ||
| 430 | - static RgbColor From(int r, int g, int b, int a = 255) { | ||
| 431 | - RgbColor c; | ||
| 430 | + static RgbaColor From(int r, int g, int b, int a = 255) { | ||
| 431 | + RgbaColor c; | ||
| 432 | 432 | c.red = (uint8_t)r; | |
| 433 | 433 | c.green = (uint8_t)g; | |
| 434 | 434 | c.blue = (uint8_t)b; | |
| 435 | 435 | c.alpha = (uint8_t)a; | |
| 436 | 436 | return c; | |
| 437 | 437 | } | |
| 438 | 438 | ||
| 439 | - static RgbColor FromFloat(float r, float g, float b, float a = 1.0) { | ||
| 439 | + static RgbaColor FromFloat(float r, float g, float b, float a = 1.0) { | ||
| 440 | 440 | return From( | |
| 441 | 441 | (int)(255.1f * r), | |
| 442 | 442 | (int)(255.1f * g), | |
| 443 | 443 | (int)(255.1f * b), | |
| 444 | 444 | (int)(255.1f * a)); | |
| 445 | 445 | } | |
| 446 | 446 | ||
| 447 | - static RgbColor FromPackedInt(uint32_t bgra) { | ||
| 447 | + static RgbaColor FromPackedInt(uint32_t bgra) { | ||
| 448 | 448 | return From( | |
| 449 | 449 | (int)((bgra) & 0xff), | |
| 450 | 450 | (int)((bgra >> 8) & 0xff), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -506,8 +506,8 @@ void VectorFileWriter::Output(SBezierLoopSetSet *sblss, SMesh *sm) { | |||
| 506 | 506 | hStyle hs = { (uint32_t)b->auxA }; | |
| 507 | 507 | Style *stl = Style::Get(hs); | |
| 508 | 508 | double lineWidth = Style::WidthMm(b->auxA)*s; | |
| 509 | - RgbColor strokeRgb = Style::Color(hs, true); | ||
| 510 | - RgbColor fillRgb = Style::FillColor(hs, true); | ||
| 509 | + RgbaColor strokeRgb = Style::Color(hs, true); | ||
| 510 | + RgbaColor fillRgb = Style::FillColor(hs, true); | ||
| 511 | 511 | ||
| 512 | 512 | StartPath(strokeRgb, lineWidth, stl->filled, fillRgb); | |
| 513 | 513 | for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,12 +71,12 @@ void DxfFileWriter::StartFile(void) { | |||
| 71 | 71 | "ENTITIES\r\n"); | |
| 72 | 72 | } | |
| 73 | 73 | ||
| 74 | - void DxfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 75 | - bool filled, RgbColor fillRgb) | ||
| 74 | + void DxfFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 75 | + bool filled, RgbaColor fillRgb) | ||
| 76 | 76 | { | |
| 77 | 77 | } | |
| 78 | - void DxfFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 79 | - bool filled, RgbColor fillRgb) | ||
| 78 | + void DxfFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 79 | + bool filled, RgbaColor fillRgb) | ||
| 80 | 80 | { | |
| 81 | 81 | } | |
| 82 | 82 | ||
@@ -172,14 +172,14 @@ void EpsFileWriter::StartFile(void) { | |||
| 172 | 172 | MmToPts(ptMax.y - ptMin.y)); | |
| 173 | 173 | } | |
| 174 | 174 | ||
| 175 | - void EpsFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 176 | - bool filled, RgbColor fillRgb) | ||
| 175 | + void EpsFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 176 | + bool filled, RgbaColor fillRgb) | ||
| 177 | 177 | { | |
| 178 | 178 | fprintf(f, "newpath\r\n"); | |
| 179 | 179 | prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); | |
| 180 | 180 | } | |
| 181 | - void EpsFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 182 | - bool filled, RgbColor fillRgb) | ||
| 181 | + void EpsFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 182 | + bool filled, RgbaColor fillRgb) | ||
| 183 | 183 | { | |
| 184 | 184 | fprintf(f, " %.3f setlinewidth\r\n" | |
| 185 | 185 | " %.3f %.3f %.3f setrgbcolor\r\n" | |
@@ -397,8 +397,8 @@ void PdfFileWriter::FinishAndCloseFile(void) { | |||
| 397 | 397 | ||
| 398 | 398 | } | |
| 399 | 399 | ||
| 400 | - void PdfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 401 | - bool filled, RgbColor fillRgb) | ||
| 400 | + void PdfFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 401 | + bool filled, RgbaColor fillRgb) | ||
| 402 | 402 | { | |
| 403 | 403 | fprintf(f, "1 J 1 j " // round endcaps and joins | |
| 404 | 404 | "%.3f w " | |
@@ -412,8 +412,8 @@ void PdfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | |||
| 412 | 412 | ||
| 413 | 413 | prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); | |
| 414 | 414 | } | |
| 415 | - void PdfFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 416 | - bool filled, RgbColor fillRgb) | ||
| 415 | + void PdfFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 416 | + bool filled, RgbaColor fillRgb) | ||
| 417 | 417 | { | |
| 418 | 418 | if(filled) { | |
| 419 | 419 | fprintf(f, "b\r\n"); | |
@@ -486,14 +486,14 @@ void SvgFileWriter::StartFile(void) { | |||
| 486 | 486 | (ptMax.x - ptMin.x), (ptMax.y - ptMin.y)); | |
| 487 | 487 | } | |
| 488 | 488 | ||
| 489 | - void SvgFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 490 | - bool filled, RgbColor fillRgb) | ||
| 489 | + void SvgFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 490 | + bool filled, RgbaColor fillRgb) | ||
| 491 | 491 | { | |
| 492 | 492 | fprintf(f, "<path d='"); | |
| 493 | 493 | prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); | |
| 494 | 494 | } | |
| 495 | - void SvgFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 496 | - bool filled, RgbColor fillRgb) | ||
| 495 | + void SvgFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 496 | + bool filled, RgbaColor fillRgb) | ||
| 497 | 497 | { | |
| 498 | 498 | char fill[100]; | |
| 499 | 499 | if(filled) { | |
@@ -591,12 +591,12 @@ void HpglFileWriter::StartFile(void) { | |||
| 591 | 591 | fprintf(f, "SP1;\r\n"); | |
| 592 | 592 | } | |
| 593 | 593 | ||
| 594 | - void HpglFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 595 | - bool filled, RgbColor fillRgb) | ||
| 594 | + void HpglFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 595 | + bool filled, RgbaColor fillRgb) | ||
| 596 | 596 | { | |
| 597 | 597 | } | |
| 598 | - void HpglFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 599 | - bool filled, RgbColor fillRgb) | ||
| 598 | + void HpglFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 599 | + bool filled, RgbaColor fillRgb) | ||
| 600 | 600 | { | |
| 601 | 601 | } | |
| 602 | 602 | ||
@@ -628,12 +628,12 @@ void HpglFileWriter::FinishAndCloseFile(void) { | |||
| 628 | 628 | void GCodeFileWriter::StartFile(void) { | |
| 629 | 629 | ZERO(&sel); | |
| 630 | 630 | } | |
| 631 | - void GCodeFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 632 | - bool filled, RgbColor fillRgb) | ||
| 631 | + void GCodeFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 632 | + bool filled, RgbaColor fillRgb) | ||
| 633 | 633 | { | |
| 634 | 634 | } | |
| 635 | - void GCodeFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 636 | - bool filled, RgbColor fillRgb) | ||
| 635 | + void GCodeFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 636 | + bool filled, RgbaColor fillRgb) | ||
| 637 | 637 | { | |
| 638 | 638 | } | |
| 639 | 639 | void GCodeFileWriter::Triangle(STriangle *tr) { | |
@@ -697,12 +697,12 @@ void Step2dFileWriter::StartFile(void) { | |||
| 697 | 697 | void Step2dFileWriter::Triangle(STriangle *tr) { | |
| 698 | 698 | } | |
| 699 | 699 | ||
| 700 | - void Step2dFileWriter::StartPath(RgbColor strokeRgb, double lineWidth, | ||
| 701 | - bool filled, RgbColor fillRgb) | ||
| 700 | + void Step2dFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, | ||
| 701 | + bool filled, RgbaColor fillRgb) | ||
| 702 | 702 | { | |
| 703 | 703 | } | |
| 704 | - void Step2dFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth, | ||
| 705 | - bool filled, RgbColor fillRgb) | ||
| 704 | + void Step2dFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, | ||
| 705 | + bool filled, RgbaColor fillRgb) | ||
| 706 | 706 | { | |
| 707 | 707 | } | |
| 708 | 708 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -203,13 +203,13 @@ const SolveSpaceUI::SaveTable SolveSpaceUI::SAVED[] = { | |||
| 203 | 203 | ||
| 204 | 204 | union SAVEDptr { | |
| 205 | 205 | IdList<EntityMap,EntityId> M; | |
| 206 | - NameStr N; | ||
| 207 | - char P[MAX_PATH]; | ||
| 208 | - bool b; | ||
| 209 | - RgbColor c; | ||
| 210 | - int d; | ||
| 211 | - double f; | ||
| 212 | - uint32_t x; | ||
| 206 | + NameStr N; | ||
| 207 | + char P[MAX_PATH]; | ||
| 208 | + bool b; | ||
| 209 | + RgbaColor c; | ||
| 210 | + int d; | ||
| 211 | + double f; | ||
| 212 | + uint32_t x; | ||
| 213 | 213 | }; | |
| 214 | 214 | ||
| 215 | 215 | void SolveSpaceUI::SaveUsingTable(int type) { | |
@@ -384,7 +384,7 @@ void SolveSpaceUI::LoadUsingTable(char *key, char *val) { | |||
| 384 | 384 | ||
| 385 | 385 | case 'c': | |
| 386 | 386 | sscanf(val, "%x", &u); | |
| 387 | - p->c = RgbColor::FromPackedInt(u); | ||
| 387 | + p->c = RgbaColor::FromPackedInt(u); | ||
| 388 | 388 | break; | |
| 389 | 389 | ||
| 390 | 390 | case 'P': | |
@@ -564,7 +564,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const char *file, EntityList *le, | |||
| 564 | 564 | &(tr.c.x), &(tr.c.y), &(tr.c.z)) != 11) { | |
| 565 | 565 | oops(); | |
| 566 | 566 | } | |
| 567 | - tr.meta.color = RgbColor::FromPackedInt((uint32_t)rgba); | ||
| 567 | + tr.meta.color = RgbaColor::FromPackedInt((uint32_t)rgba); | ||
| 568 | 568 | m->AddTriangle(&tr); | |
| 569 | 569 | } else if(StrStartsWith(line, "Surface ")) { | |
| 570 | 570 | unsigned int rgba = 0; | |
@@ -573,7 +573,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const char *file, EntityList *le, | |||
| 573 | 573 | &(srf.degm), &(srf.degn)) != 5) { | |
| 574 | 574 | oops(); | |
| 575 | 575 | } | |
| 576 | - srf.color = RgbColor::FromPackedInt((uint32_t)rgba); | ||
| 576 | + srf.color = RgbaColor::FromPackedInt((uint32_t)rgba); | ||
| 577 | 577 | } else if(StrStartsWith(line, "SCtrl ")) { | |
| 578 | 578 | int i, j; | |
| 579 | 579 | Vector c; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -198,7 +198,7 @@ void ssglFatLine(Vector a, Vector b, double width) | |||
| 198 | 198 | } | |
| 199 | 199 | ||
| 200 | 200 | ||
| 201 | - void ssglLockColorTo(RgbColor rgb) | ||
| 201 | + void ssglLockColorTo(RgbaColor rgb) | ||
| 202 | 202 | { | |
| 203 | 203 | ColorLocked = false; | |
| 204 | 204 | glColor3d(rgb.redF(), rgb.greenF(), rgb.blueF()); | |
@@ -210,14 +210,14 @@ void ssglUnlockColor(void) | |||
| 210 | 210 | ColorLocked = false; | |
| 211 | 211 | } | |
| 212 | 212 | ||
| 213 | - void ssglColorRGB(RgbColor rgb) | ||
| 213 | + void ssglColorRGB(RgbaColor rgb) | ||
| 214 | 214 | { | |
| 215 | 215 | // Is there a bug in some graphics drivers where this is not equivalent | |
| 216 | 216 | // to glColor3d? There seems to be... | |
| 217 | 217 | ssglColorRGBa(rgb, 1.0); | |
| 218 | 218 | } | |
| 219 | 219 | ||
| 220 | - void ssglColorRGBa(RgbColor rgb, double a) | ||
| 220 | + void ssglColorRGBa(RgbaColor rgb, double a) | ||
| 221 | 221 | { | |
| 222 | 222 | if(!ColorLocked) glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), a); | |
| 223 | 223 | } | |
@@ -253,7 +253,7 @@ static void Stipple(bool forSel) | |||
| 253 | 253 | } | |
| 254 | 254 | } | |
| 255 | 255 | ||
| 256 | - static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb) | ||
| 256 | + static void StippleTriangle(STriangle *tr, bool s, RgbaColor rgb) | ||
| 257 | 257 | { | |
| 258 | 258 | glEnd(); | |
| 259 | 259 | glDisable(GL_LIGHTING); | |
@@ -269,20 +269,20 @@ static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb) | |||
| 269 | 269 | glBegin(GL_TRIANGLES); | |
| 270 | 270 | } | |
| 271 | 271 | ||
| 272 | - void ssglFillMesh(bool useSpecColor, RgbColor specColor, | ||
| 272 | + void ssglFillMesh(bool useSpecColor, RgbaColor specColor, | ||
| 273 | 273 | SMesh *m, uint32_t h, uint32_t s1, uint32_t s2) | |
| 274 | 274 | { | |
| 275 | - RgbColor rgbHovered = Style::Color(Style::HOVERED), | ||
| 275 | + RgbaColor rgbHovered = Style::Color(Style::HOVERED), | ||
| 276 | 276 | rgbSelected = Style::Color(Style::SELECTED); | |
| 277 | 277 | ||
| 278 | 278 | glEnable(GL_NORMALIZE); | |
| 279 | 279 | bool hasMaterial = false; | |
| 280 | - RgbColor prevColor; | ||
| 280 | + RgbaColor prevColor; | ||
| 281 | 281 | glBegin(GL_TRIANGLES); | |
| 282 | 282 | for(int i = 0; i < m->l.n; i++) { | |
| 283 | 283 | STriangle *tr = &(m->l.elem[i]); | |
| 284 | 284 | ||
| 285 | - RgbColor color; | ||
| 285 | + RgbaColor color; | ||
| 286 | 286 | if(useSpecColor) { | |
| 287 | 287 | color = specColor; | |
| 288 | 288 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -434,7 +434,7 @@ Group *Group::RunningMeshGroup(void) { | |||
| 434 | 434 | } | |
| 435 | 435 | ||
| 436 | 436 | void Group::DrawDisplayItems(int t) { | |
| 437 | - RgbColor specColor; | ||
| 437 | + RgbaColor specColor; | ||
| 438 | 438 | bool useSpecColor; | |
| 439 | 439 | if(t == DRAWING_3D || t == DRAWING_WORKPLANE) { | |
| 440 | 440 | // force the color to something dim | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,7 +123,7 @@ class SContour { | |||
| 123 | 123 | ||
| 124 | 124 | typedef struct { | |
| 125 | 125 | uint32_t face; | |
| 126 | - RgbColor color; | ||
| 126 | + RgbaColor color; | ||
| 127 | 127 | } STriMeta; | |
| 128 | 128 | ||
| 129 | 129 | class SPolygon { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments