FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rename RgbColor to RgbaColor. · solvespace/solvespace@5e7c7fc · GitHub

Commit 5e7c7fc

Browse files
committed
Rename RgbColor to RgbaColor.
1 parent 75a3936 commit 5e7c7fc

17 files changed

Lines changed: 144 additions & 144 deletions

‎src/draw.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void GraphicsWindow::Selection::Draw(void) {
6161
topLeft = topLeft.Minus(SS.GW.offset);
6262

6363
ssglLineWidth(40);
64-
RgbColor rgb = Style::Color(Style::HOVERED);
64+
RgbaColor rgb = Style::Color(Style::HOVERED);
6565
glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), 0.2);
6666
glBegin(GL_LINES);
6767
ssglVertex3v(topLeft);
@@ -517,7 +517,7 @@ void GraphicsWindow::Paint(void) {
517517
SS.backgroundColor.blueF(), 1.0f);
518518
} else {
519519
// 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);
521521
glClearColor(0.4f*rgb.redF(), 0.4f*rgb.greenF(), 0.4f*rgb.blueF(), 1.0f);
522522
// And show the text window, which has info to debug it
523523
ForceTextWindowShown();

‎src/drawconstraint.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
570570
// Let's adjust the color of this constraint to have the same
571571
// rough luma as the point color, so that the constraint does not
572572
// stand out in an ugly way.
573-
RgbColor cd = Style::Color(Style::DATUM),
573+
RgbaColor cd = Style::Color(Style::DATUM),
574574
cc = Style::Color(Style::CONSTRAINT);
575575
// convert from 8-bit color to a vector
576576
Vector vd = Vector::From(cd.redF(), cd.greenF(), cd.blueF()),

‎src/dsc.h‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,12 @@ class BandedMatrix {
397397
void Solve(void);
398398
};
399399

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))
402402

403-
// Note: sizeof(class RgbColor) should be exactly 4
403+
// Note: sizeof(class RgbaColor) should be exactly 4
404404
//
405-
class RgbColor {
405+
class RgbaColor {
406406
public:
407407
uint8_t red, green, blue, alpha;
408408

@@ -411,7 +411,7 @@ class RgbColor {
411411
float blueF(void) const { return (float)blue / 255.0f; }
412412
float alphaF(void) const { return (float)alpha / 255.0f; }
413413

414-
bool Equals(RgbColor c) const {
414+
bool Equals(RgbaColor c) const {
415415
return
416416
c.red == red &&
417417
c.green == green &&
@@ -427,24 +427,24 @@ class RgbColor {
427427
(uint32_t)((255 - alpha) << 24);
428428
}
429429

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;
432432
c.red = (uint8_t)r;
433433
c.green = (uint8_t)g;
434434
c.blue = (uint8_t)b;
435435
c.alpha = (uint8_t)a;
436436
return c;
437437
}
438438

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) {
440440
return From(
441441
(int)(255.1f * r),
442442
(int)(255.1f * g),
443443
(int)(255.1f * b),
444444
(int)(255.1f * a));
445445
}
446446

447-
static RgbColor FromPackedInt(uint32_t bgra) {
447+
static RgbaColor FromPackedInt(uint32_t bgra) {
448448
return From(
449449
(int)((bgra) & 0xff),
450450
(int)((bgra >> 8) & 0xff),

‎src/export.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ void VectorFileWriter::Output(SBezierLoopSetSet *sblss, SMesh *sm) {
506506
hStyle hs = { (uint32_t)b->auxA };
507507
Style *stl = Style::Get(hs);
508508
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);
511511

512512
StartPath(strokeRgb, lineWidth, stl->filled, fillRgb);
513513
for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) {

‎src/exportvector.cpp‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void DxfFileWriter::StartFile(void) {
7171
"ENTITIES\r\n");
7272
}
7373

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)
7676
{
7777
}
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)
8080
{
8181
}
8282

@@ -172,14 +172,14 @@ void EpsFileWriter::StartFile(void) {
172172
MmToPts(ptMax.y - ptMin.y));
173173
}
174174

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)
177177
{
178178
fprintf(f, "newpath\r\n");
179179
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
180180
}
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)
183183
{
184184
fprintf(f, " %.3f setlinewidth\r\n"
185185
" %.3f %.3f %.3f setrgbcolor\r\n"
@@ -397,8 +397,8 @@ void PdfFileWriter::FinishAndCloseFile(void) {
397397

398398
}
399399

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)
402402
{
403403
fprintf(f, "1 J 1 j " // round endcaps and joins
404404
"%.3f w "
@@ -412,8 +412,8 @@ void PdfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
412412

413413
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
414414
}
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)
417417
{
418418
if(filled) {
419419
fprintf(f, "b\r\n");
@@ -486,14 +486,14 @@ void SvgFileWriter::StartFile(void) {
486486
(ptMax.x - ptMin.x), (ptMax.y - ptMin.y));
487487
}
488488

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)
491491
{
492492
fprintf(f, "<path d='");
493493
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
494494
}
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)
497497
{
498498
char fill[100];
499499
if(filled) {
@@ -591,12 +591,12 @@ void HpglFileWriter::StartFile(void) {
591591
fprintf(f, "SP1;\r\n");
592592
}
593593

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)
596596
{
597597
}
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)
600600
{
601601
}
602602

@@ -628,12 +628,12 @@ void HpglFileWriter::FinishAndCloseFile(void) {
628628
void GCodeFileWriter::StartFile(void) {
629629
ZERO(&sel);
630630
}
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)
633633
{
634634
}
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)
637637
{
638638
}
639639
void GCodeFileWriter::Triangle(STriangle *tr) {
@@ -697,12 +697,12 @@ void Step2dFileWriter::StartFile(void) {
697697
void Step2dFileWriter::Triangle(STriangle *tr) {
698698
}
699699

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)
702702
{
703703
}
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)
706706
{
707707
}
708708

‎src/file.cpp‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ const SolveSpaceUI::SaveTable SolveSpaceUI::SAVED[] = {
203203

204204
union SAVEDptr {
205205
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;
213213
};
214214

215215
void SolveSpaceUI::SaveUsingTable(int type) {
@@ -384,7 +384,7 @@ void SolveSpaceUI::LoadUsingTable(char *key, char *val) {
384384

385385
case 'c':
386386
sscanf(val, "%x", &u);
387-
p->c = RgbColor::FromPackedInt(u);
387+
p->c = RgbaColor::FromPackedInt(u);
388388
break;
389389

390390
case 'P':
@@ -564,7 +564,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const char *file, EntityList *le,
564564
&(tr.c.x), &(tr.c.y), &(tr.c.z)) != 11) {
565565
oops();
566566
}
567-
tr.meta.color = RgbColor::FromPackedInt((uint32_t)rgba);
567+
tr.meta.color = RgbaColor::FromPackedInt((uint32_t)rgba);
568568
m->AddTriangle(&tr);
569569
} else if(StrStartsWith(line, "Surface ")) {
570570
unsigned int rgba = 0;
@@ -573,7 +573,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const char *file, EntityList *le,
573573
&(srf.degm), &(srf.degn)) != 5) {
574574
oops();
575575
}
576-
srf.color = RgbColor::FromPackedInt((uint32_t)rgba);
576+
srf.color = RgbaColor::FromPackedInt((uint32_t)rgba);
577577
} else if(StrStartsWith(line, "SCtrl ")) {
578578
int i, j;
579579
Vector c;

‎src/glhelper.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void ssglFatLine(Vector a, Vector b, double width)
198198
}
199199

200200

201-
void ssglLockColorTo(RgbColor rgb)
201+
void ssglLockColorTo(RgbaColor rgb)
202202
{
203203
ColorLocked = false;
204204
glColor3d(rgb.redF(), rgb.greenF(), rgb.blueF());
@@ -210,14 +210,14 @@ void ssglUnlockColor(void)
210210
ColorLocked = false;
211211
}
212212

213-
void ssglColorRGB(RgbColor rgb)
213+
void ssglColorRGB(RgbaColor rgb)
214214
{
215215
// Is there a bug in some graphics drivers where this is not equivalent
216216
// to glColor3d? There seems to be...
217217
ssglColorRGBa(rgb, 1.0);
218218
}
219219

220-
void ssglColorRGBa(RgbColor rgb, double a)
220+
void ssglColorRGBa(RgbaColor rgb, double a)
221221
{
222222
if(!ColorLocked) glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), a);
223223
}
@@ -253,7 +253,7 @@ static void Stipple(bool forSel)
253253
}
254254
}
255255

256-
static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb)
256+
static void StippleTriangle(STriangle *tr, bool s, RgbaColor rgb)
257257
{
258258
glEnd();
259259
glDisable(GL_LIGHTING);
@@ -269,20 +269,20 @@ static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb)
269269
glBegin(GL_TRIANGLES);
270270
}
271271

272-
void ssglFillMesh(bool useSpecColor, RgbColor specColor,
272+
void ssglFillMesh(bool useSpecColor, RgbaColor specColor,
273273
SMesh *m, uint32_t h, uint32_t s1, uint32_t s2)
274274
{
275-
RgbColor rgbHovered = Style::Color(Style::HOVERED),
275+
RgbaColor rgbHovered = Style::Color(Style::HOVERED),
276276
rgbSelected = Style::Color(Style::SELECTED);
277277

278278
glEnable(GL_NORMALIZE);
279279
bool hasMaterial = false;
280-
RgbColor prevColor;
280+
RgbaColor prevColor;
281281
glBegin(GL_TRIANGLES);
282282
for(int i = 0; i < m->l.n; i++) {
283283
STriangle *tr = &(m->l.elem[i]);
284284

285-
RgbColor color;
285+
RgbaColor color;
286286
if(useSpecColor) {
287287
color = specColor;
288288
} else {

‎src/groupmesh.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Group *Group::RunningMeshGroup(void) {
434434
}
435435

436436
void Group::DrawDisplayItems(int t) {
437-
RgbColor specColor;
437+
RgbaColor specColor;
438438
bool useSpecColor;
439439
if(t == DRAWING_3D || t == DRAWING_WORKPLANE) {
440440
// force the color to something dim

‎src/polygon.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class SContour {
123123

124124
typedef struct {
125125
uint32_t face;
126-
RgbColor color;
126+
RgbaColor color;
127127
} STriMeta;
128128

129129
class SPolygon {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL