Rename RgbColor to RgbaColor.
parent
75a3936b64
commit
5e7c7fce7e
|
@ -61,7 +61,7 @@ void GraphicsWindow::Selection::Draw(void) {
|
||||||
topLeft = topLeft.Minus(SS.GW.offset);
|
topLeft = topLeft.Minus(SS.GW.offset);
|
||||||
|
|
||||||
ssglLineWidth(40);
|
ssglLineWidth(40);
|
||||||
RgbColor rgb = Style::Color(Style::HOVERED);
|
RgbaColor rgb = Style::Color(Style::HOVERED);
|
||||||
glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), 0.2);
|
glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), 0.2);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
ssglVertex3v(topLeft);
|
ssglVertex3v(topLeft);
|
||||||
|
@ -517,7 +517,7 @@ void GraphicsWindow::Paint(void) {
|
||||||
SS.backgroundColor.blueF(), 1.0f);
|
SS.backgroundColor.blueF(), 1.0f);
|
||||||
} else {
|
} else {
|
||||||
// Draw a different background whenever we're having solve problems.
|
// Draw a different background whenever we're having solve problems.
|
||||||
RgbColor rgb = Style::Color(Style::DRAW_ERROR);
|
RgbaColor rgb = Style::Color(Style::DRAW_ERROR);
|
||||||
glClearColor(0.4f*rgb.redF(), 0.4f*rgb.greenF(), 0.4f*rgb.blueF(), 1.0f);
|
glClearColor(0.4f*rgb.redF(), 0.4f*rgb.greenF(), 0.4f*rgb.blueF(), 1.0f);
|
||||||
// And show the text window, which has info to debug it
|
// And show the text window, which has info to debug it
|
||||||
ForceTextWindowShown();
|
ForceTextWindowShown();
|
||||||
|
|
|
@ -570,7 +570,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
||||||
// Let's adjust the color of this constraint to have the same
|
// Let's adjust the color of this constraint to have the same
|
||||||
// rough luma as the point color, so that the constraint does not
|
// rough luma as the point color, so that the constraint does not
|
||||||
// stand out in an ugly way.
|
// stand out in an ugly way.
|
||||||
RgbColor cd = Style::Color(Style::DATUM),
|
RgbaColor cd = Style::Color(Style::DATUM),
|
||||||
cc = Style::Color(Style::CONSTRAINT);
|
cc = Style::Color(Style::CONSTRAINT);
|
||||||
// convert from 8-bit color to a vector
|
// convert from 8-bit color to a vector
|
||||||
Vector vd = Vector::From(cd.redF(), cd.greenF(), cd.blueF()),
|
Vector vd = Vector::From(cd.redF(), cd.greenF(), cd.blueF()),
|
||||||
|
|
18
src/dsc.h
18
src/dsc.h
|
@ -397,12 +397,12 @@ public:
|
||||||
void Solve(void);
|
void Solve(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RGBi(r, g, b) RgbColor::From((r), (g), (b))
|
#define RGBi(r, g, b) RgbaColor::From((r), (g), (b))
|
||||||
#define RGBf(r, g, b) RgbColor::FromFloat((float)(r), (float)(g), (float)(b))
|
#define RGBf(r, g, b) RgbaColor::FromFloat((float)(r), (float)(g), (float)(b))
|
||||||
|
|
||||||
// Note: sizeof(class RgbColor) should be exactly 4
|
// Note: sizeof(class RgbaColor) should be exactly 4
|
||||||
//
|
//
|
||||||
class RgbColor {
|
class RgbaColor {
|
||||||
public:
|
public:
|
||||||
uint8_t red, green, blue, alpha;
|
uint8_t red, green, blue, alpha;
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ public:
|
||||||
float blueF(void) const { return (float)blue / 255.0f; }
|
float blueF(void) const { return (float)blue / 255.0f; }
|
||||||
float alphaF(void) const { return (float)alpha / 255.0f; }
|
float alphaF(void) const { return (float)alpha / 255.0f; }
|
||||||
|
|
||||||
bool Equals(RgbColor c) const {
|
bool Equals(RgbaColor c) const {
|
||||||
return
|
return
|
||||||
c.red == red &&
|
c.red == red &&
|
||||||
c.green == green &&
|
c.green == green &&
|
||||||
|
@ -427,8 +427,8 @@ public:
|
||||||
(uint32_t)((255 - alpha) << 24);
|
(uint32_t)((255 - alpha) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RgbColor From(int r, int g, int b, int a = 255) {
|
static RgbaColor From(int r, int g, int b, int a = 255) {
|
||||||
RgbColor c;
|
RgbaColor c;
|
||||||
c.red = (uint8_t)r;
|
c.red = (uint8_t)r;
|
||||||
c.green = (uint8_t)g;
|
c.green = (uint8_t)g;
|
||||||
c.blue = (uint8_t)b;
|
c.blue = (uint8_t)b;
|
||||||
|
@ -436,7 +436,7 @@ public:
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RgbColor FromFloat(float r, float g, float b, float a = 1.0) {
|
static RgbaColor FromFloat(float r, float g, float b, float a = 1.0) {
|
||||||
return From(
|
return From(
|
||||||
(int)(255.1f * r),
|
(int)(255.1f * r),
|
||||||
(int)(255.1f * g),
|
(int)(255.1f * g),
|
||||||
|
@ -444,7 +444,7 @@ public:
|
||||||
(int)(255.1f * a));
|
(int)(255.1f * a));
|
||||||
}
|
}
|
||||||
|
|
||||||
static RgbColor FromPackedInt(uint32_t bgra) {
|
static RgbaColor FromPackedInt(uint32_t bgra) {
|
||||||
return From(
|
return From(
|
||||||
(int)((bgra) & 0xff),
|
(int)((bgra) & 0xff),
|
||||||
(int)((bgra >> 8) & 0xff),
|
(int)((bgra >> 8) & 0xff),
|
||||||
|
|
|
@ -506,8 +506,8 @@ void VectorFileWriter::Output(SBezierLoopSetSet *sblss, SMesh *sm) {
|
||||||
hStyle hs = { (uint32_t)b->auxA };
|
hStyle hs = { (uint32_t)b->auxA };
|
||||||
Style *stl = Style::Get(hs);
|
Style *stl = Style::Get(hs);
|
||||||
double lineWidth = Style::WidthMm(b->auxA)*s;
|
double lineWidth = Style::WidthMm(b->auxA)*s;
|
||||||
RgbColor strokeRgb = Style::Color(hs, true);
|
RgbaColor strokeRgb = Style::Color(hs, true);
|
||||||
RgbColor fillRgb = Style::FillColor(hs, true);
|
RgbaColor fillRgb = Style::FillColor(hs, true);
|
||||||
|
|
||||||
StartPath(strokeRgb, lineWidth, stl->filled, fillRgb);
|
StartPath(strokeRgb, lineWidth, stl->filled, fillRgb);
|
||||||
for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) {
|
for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) {
|
||||||
|
|
|
@ -71,12 +71,12 @@ void DxfFileWriter::StartFile(void) {
|
||||||
"ENTITIES\r\n");
|
"ENTITIES\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DxfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void DxfFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void DxfFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void DxfFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,14 +172,14 @@ void EpsFileWriter::StartFile(void) {
|
||||||
MmToPts(ptMax.y - ptMin.y));
|
MmToPts(ptMax.y - ptMin.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EpsFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void EpsFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
fprintf(f, "newpath\r\n");
|
fprintf(f, "newpath\r\n");
|
||||||
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
|
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
|
||||||
}
|
}
|
||||||
void EpsFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void EpsFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
fprintf(f, " %.3f setlinewidth\r\n"
|
fprintf(f, " %.3f setlinewidth\r\n"
|
||||||
" %.3f %.3f %.3f setrgbcolor\r\n"
|
" %.3f %.3f %.3f setrgbcolor\r\n"
|
||||||
|
@ -397,8 +397,8 @@ void PdfFileWriter::FinishAndCloseFile(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void PdfFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
fprintf(f, "1 J 1 j " // round endcaps and joins
|
fprintf(f, "1 J 1 j " // round endcaps and joins
|
||||||
"%.3f w "
|
"%.3f w "
|
||||||
|
@ -412,8 +412,8 @@ void PdfFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
||||||
|
|
||||||
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
|
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
|
||||||
}
|
}
|
||||||
void PdfFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void PdfFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
if(filled) {
|
if(filled) {
|
||||||
fprintf(f, "b\r\n");
|
fprintf(f, "b\r\n");
|
||||||
|
@ -486,14 +486,14 @@ void SvgFileWriter::StartFile(void) {
|
||||||
(ptMax.x - ptMin.x), (ptMax.y - ptMin.y));
|
(ptMax.x - ptMin.x), (ptMax.y - ptMin.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvgFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void SvgFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
fprintf(f, "<path d='");
|
fprintf(f, "<path d='");
|
||||||
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
|
prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE);
|
||||||
}
|
}
|
||||||
void SvgFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void SvgFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
char fill[100];
|
char fill[100];
|
||||||
if(filled) {
|
if(filled) {
|
||||||
|
@ -591,12 +591,12 @@ void HpglFileWriter::StartFile(void) {
|
||||||
fprintf(f, "SP1;\r\n");
|
fprintf(f, "SP1;\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void HpglFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void HpglFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void HpglFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void HpglFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,12 +628,12 @@ void HpglFileWriter::FinishAndCloseFile(void) {
|
||||||
void GCodeFileWriter::StartFile(void) {
|
void GCodeFileWriter::StartFile(void) {
|
||||||
ZERO(&sel);
|
ZERO(&sel);
|
||||||
}
|
}
|
||||||
void GCodeFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void GCodeFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void GCodeFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void GCodeFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void GCodeFileWriter::Triangle(STriangle *tr) {
|
void GCodeFileWriter::Triangle(STriangle *tr) {
|
||||||
|
@ -697,12 +697,12 @@ void Step2dFileWriter::StartFile(void) {
|
||||||
void Step2dFileWriter::Triangle(STriangle *tr) {
|
void Step2dFileWriter::Triangle(STriangle *tr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Step2dFileWriter::StartPath(RgbColor strokeRgb, double lineWidth,
|
void Step2dFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Step2dFileWriter::FinishPath(RgbColor strokeRgb, double lineWidth,
|
void Step2dFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb)
|
bool filled, RgbaColor fillRgb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ union SAVEDptr {
|
||||||
NameStr N;
|
NameStr N;
|
||||||
char P[MAX_PATH];
|
char P[MAX_PATH];
|
||||||
bool b;
|
bool b;
|
||||||
RgbColor c;
|
RgbaColor c;
|
||||||
int d;
|
int d;
|
||||||
double f;
|
double f;
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
|
@ -384,7 +384,7 @@ void SolveSpaceUI::LoadUsingTable(char *key, char *val) {
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
sscanf(val, "%x", &u);
|
sscanf(val, "%x", &u);
|
||||||
p->c = RgbColor::FromPackedInt(u);
|
p->c = RgbaColor::FromPackedInt(u);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
|
@ -564,7 +564,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const char *file, EntityList *le,
|
||||||
&(tr.c.x), &(tr.c.y), &(tr.c.z)) != 11) {
|
&(tr.c.x), &(tr.c.y), &(tr.c.z)) != 11) {
|
||||||
oops();
|
oops();
|
||||||
}
|
}
|
||||||
tr.meta.color = RgbColor::FromPackedInt((uint32_t)rgba);
|
tr.meta.color = RgbaColor::FromPackedInt((uint32_t)rgba);
|
||||||
m->AddTriangle(&tr);
|
m->AddTriangle(&tr);
|
||||||
} else if(StrStartsWith(line, "Surface ")) {
|
} else if(StrStartsWith(line, "Surface ")) {
|
||||||
unsigned int rgba = 0;
|
unsigned int rgba = 0;
|
||||||
|
@ -573,7 +573,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const char *file, EntityList *le,
|
||||||
&(srf.degm), &(srf.degn)) != 5) {
|
&(srf.degm), &(srf.degn)) != 5) {
|
||||||
oops();
|
oops();
|
||||||
}
|
}
|
||||||
srf.color = RgbColor::FromPackedInt((uint32_t)rgba);
|
srf.color = RgbaColor::FromPackedInt((uint32_t)rgba);
|
||||||
} else if(StrStartsWith(line, "SCtrl ")) {
|
} else if(StrStartsWith(line, "SCtrl ")) {
|
||||||
int i, j;
|
int i, j;
|
||||||
Vector c;
|
Vector c;
|
||||||
|
|
|
@ -198,7 +198,7 @@ void ssglFatLine(Vector a, Vector b, double width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ssglLockColorTo(RgbColor rgb)
|
void ssglLockColorTo(RgbaColor rgb)
|
||||||
{
|
{
|
||||||
ColorLocked = false;
|
ColorLocked = false;
|
||||||
glColor3d(rgb.redF(), rgb.greenF(), rgb.blueF());
|
glColor3d(rgb.redF(), rgb.greenF(), rgb.blueF());
|
||||||
|
@ -210,14 +210,14 @@ void ssglUnlockColor(void)
|
||||||
ColorLocked = false;
|
ColorLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssglColorRGB(RgbColor rgb)
|
void ssglColorRGB(RgbaColor rgb)
|
||||||
{
|
{
|
||||||
// Is there a bug in some graphics drivers where this is not equivalent
|
// Is there a bug in some graphics drivers where this is not equivalent
|
||||||
// to glColor3d? There seems to be...
|
// to glColor3d? There seems to be...
|
||||||
ssglColorRGBa(rgb, 1.0);
|
ssglColorRGBa(rgb, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssglColorRGBa(RgbColor rgb, double a)
|
void ssglColorRGBa(RgbaColor rgb, double a)
|
||||||
{
|
{
|
||||||
if(!ColorLocked) glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), a);
|
if(!ColorLocked) glColor4d(rgb.redF(), rgb.greenF(), rgb.blueF(), a);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ static void Stipple(bool forSel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb)
|
static void StippleTriangle(STriangle *tr, bool s, RgbaColor rgb)
|
||||||
{
|
{
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
@ -269,20 +269,20 @@ static void StippleTriangle(STriangle *tr, bool s, RgbColor rgb)
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssglFillMesh(bool useSpecColor, RgbColor specColor,
|
void ssglFillMesh(bool useSpecColor, RgbaColor specColor,
|
||||||
SMesh *m, uint32_t h, uint32_t s1, uint32_t s2)
|
SMesh *m, uint32_t h, uint32_t s1, uint32_t s2)
|
||||||
{
|
{
|
||||||
RgbColor rgbHovered = Style::Color(Style::HOVERED),
|
RgbaColor rgbHovered = Style::Color(Style::HOVERED),
|
||||||
rgbSelected = Style::Color(Style::SELECTED);
|
rgbSelected = Style::Color(Style::SELECTED);
|
||||||
|
|
||||||
glEnable(GL_NORMALIZE);
|
glEnable(GL_NORMALIZE);
|
||||||
bool hasMaterial = false;
|
bool hasMaterial = false;
|
||||||
RgbColor prevColor;
|
RgbaColor prevColor;
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
for(int i = 0; i < m->l.n; i++) {
|
for(int i = 0; i < m->l.n; i++) {
|
||||||
STriangle *tr = &(m->l.elem[i]);
|
STriangle *tr = &(m->l.elem[i]);
|
||||||
|
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
if(useSpecColor) {
|
if(useSpecColor) {
|
||||||
color = specColor;
|
color = specColor;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -434,7 +434,7 @@ Group *Group::RunningMeshGroup(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::DrawDisplayItems(int t) {
|
void Group::DrawDisplayItems(int t) {
|
||||||
RgbColor specColor;
|
RgbaColor specColor;
|
||||||
bool useSpecColor;
|
bool useSpecColor;
|
||||||
if(t == DRAWING_3D || t == DRAWING_WORKPLANE) {
|
if(t == DRAWING_3D || t == DRAWING_WORKPLANE) {
|
||||||
// force the color to something dim
|
// force the color to something dim
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t face;
|
uint32_t face;
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
} STriMeta;
|
} STriMeta;
|
||||||
|
|
||||||
class SPolygon {
|
class SPolygon {
|
||||||
|
|
18
src/sketch.h
18
src/sketch.h
|
@ -118,7 +118,7 @@ public:
|
||||||
double valA;
|
double valA;
|
||||||
double valB;
|
double valB;
|
||||||
double valC;
|
double valC;
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int how;
|
int how;
|
||||||
|
@ -242,7 +242,7 @@ public:
|
||||||
void GenerateDisplayItems(void);
|
void GenerateDisplayItems(void);
|
||||||
void DrawDisplayItems(int t);
|
void DrawDisplayItems(int t);
|
||||||
void Draw(void);
|
void Draw(void);
|
||||||
RgbColor GetLoopSetFillColor(SBezierLoopSet *sbls,
|
RgbaColor GetLoopSetFillColor(SBezierLoopSet *sbls,
|
||||||
bool *allSame, Vector *errorAt);
|
bool *allSame, Vector *errorAt);
|
||||||
void FillLoopSetAsPolygon(SBezierLoopSet *sbls);
|
void FillLoopSetAsPolygon(SBezierLoopSet *sbls);
|
||||||
void DrawFilledPaths(void);
|
void DrawFilledPaths(void);
|
||||||
|
@ -729,9 +729,9 @@ public:
|
||||||
};
|
};
|
||||||
int textOrigin;
|
int textOrigin;
|
||||||
double textAngle;
|
double textAngle;
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
bool filled;
|
bool filled;
|
||||||
RgbColor fillColor;
|
RgbaColor fillColor;
|
||||||
bool visible;
|
bool visible;
|
||||||
bool exportable;
|
bool exportable;
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ public:
|
||||||
typedef struct {
|
typedef struct {
|
||||||
hStyle h;
|
hStyle h;
|
||||||
const char *cnfPrefix;
|
const char *cnfPrefix;
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
double width;
|
double width;
|
||||||
} Default;
|
} Default;
|
||||||
static const Default Defaults[];
|
static const Default Defaults[];
|
||||||
|
@ -757,13 +757,13 @@ public:
|
||||||
static void AssignSelectionToStyle(uint32_t v);
|
static void AssignSelectionToStyle(uint32_t v);
|
||||||
static uint32_t CreateCustomStyle(void);
|
static uint32_t CreateCustomStyle(void);
|
||||||
|
|
||||||
static RgbColor RewriteColor(RgbColor rgb);
|
static RgbaColor RewriteColor(RgbaColor rgb);
|
||||||
|
|
||||||
static Style *Get(hStyle hs);
|
static Style *Get(hStyle hs);
|
||||||
static RgbColor Color(hStyle hs, bool forExport=false);
|
static RgbaColor Color(hStyle hs, bool forExport=false);
|
||||||
static RgbColor FillColor(hStyle hs, bool forExport=false);
|
static RgbaColor FillColor(hStyle hs, bool forExport=false);
|
||||||
static float Width(hStyle hs);
|
static float Width(hStyle hs);
|
||||||
static RgbColor Color(int hs, bool forExport=false);
|
static RgbaColor Color(int hs, bool forExport=false);
|
||||||
static float Width(int hs);
|
static float Width(int hs);
|
||||||
static double WidthMm(int hs);
|
static double WidthMm(int hs);
|
||||||
static double TextHeight(hStyle hs);
|
static double TextHeight(hStyle hs);
|
||||||
|
|
|
@ -115,7 +115,7 @@ inline double Random(double vmax) {
|
||||||
class Expr;
|
class Expr;
|
||||||
class ExprVector;
|
class ExprVector;
|
||||||
class ExprQuaternion;
|
class ExprQuaternion;
|
||||||
class RgbColor;
|
class RgbaColor;
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
# define MAX_PATH PATH_MAX
|
# define MAX_PATH PATH_MAX
|
||||||
|
@ -300,7 +300,7 @@ void ssglAxisAlignedLineLoop(double l, double r, double t, double b);
|
||||||
extern "C" { typedef void SSGL_CALLBACK ssglCallbackFptr(void); }
|
extern "C" { typedef void SSGL_CALLBACK ssglCallbackFptr(void); }
|
||||||
void ssglTesselatePolygon(GLUtesselator *gt, SPolygon *p);
|
void ssglTesselatePolygon(GLUtesselator *gt, SPolygon *p);
|
||||||
void ssglFillPolygon(SPolygon *p);
|
void ssglFillPolygon(SPolygon *p);
|
||||||
void ssglFillMesh(bool useSpecColor, RgbColor color,
|
void ssglFillMesh(bool useSpecColor, RgbaColor color,
|
||||||
SMesh *m, uint32_t h, uint32_t s1, uint32_t s2);
|
SMesh *m, uint32_t h, uint32_t s1, uint32_t s2);
|
||||||
void ssglDebugPolygon(SPolygon *p);
|
void ssglDebugPolygon(SPolygon *p);
|
||||||
void ssglDrawEdges(SEdgeList *l, bool endpointsToo);
|
void ssglDrawEdges(SEdgeList *l, bool endpointsToo);
|
||||||
|
@ -313,11 +313,11 @@ void ssglWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vecto
|
||||||
ssglLineFn *fn, void *fndata);
|
ssglLineFn *fn, void *fndata);
|
||||||
double ssglStrWidth(const char *str, double h);
|
double ssglStrWidth(const char *str, double h);
|
||||||
double ssglStrHeight(double h);
|
double ssglStrHeight(double h);
|
||||||
void ssglLockColorTo(RgbColor rgb);
|
void ssglLockColorTo(RgbaColor rgb);
|
||||||
void ssglFatLine(Vector a, Vector b, double width);
|
void ssglFatLine(Vector a, Vector b, double width);
|
||||||
void ssglUnlockColor(void);
|
void ssglUnlockColor(void);
|
||||||
void ssglColorRGB(RgbColor rgb);
|
void ssglColorRGB(RgbaColor rgb);
|
||||||
void ssglColorRGBa(RgbColor rgb, double a);
|
void ssglColorRGBa(RgbaColor rgb, double a);
|
||||||
void ssglDepthRangeOffset(int units);
|
void ssglDepthRangeOffset(int units);
|
||||||
void ssglDepthRangeLockToFront(bool yes);
|
void ssglDepthRangeLockToFront(bool yes);
|
||||||
void ssglDrawPixelsWithTexture(uint8_t *data, int w, int h);
|
void ssglDrawPixelsWithTexture(uint8_t *data, int w, int h);
|
||||||
|
@ -345,9 +345,9 @@ bool StringEndsIn(const char *str, const char *ending);
|
||||||
void Message(const char *str, ...);
|
void Message(const char *str, ...);
|
||||||
void Error(const char *str, ...);
|
void Error(const char *str, ...);
|
||||||
void CnfFreezeBool(bool v, const char *name);
|
void CnfFreezeBool(bool v, const char *name);
|
||||||
void CnfFreezeColor(RgbColor v, const char *name);
|
void CnfFreezeColor(RgbaColor v, const char *name);
|
||||||
bool CnfThawBool(bool v, const char *name);
|
bool CnfThawBool(bool v, const char *name);
|
||||||
RgbColor CnfThawColor(RgbColor v, const char *name);
|
RgbaColor CnfThawColor(RgbaColor v, const char *name);
|
||||||
|
|
||||||
class System {
|
class System {
|
||||||
public:
|
public:
|
||||||
|
@ -546,10 +546,10 @@ public:
|
||||||
void BezierAsPwl(SBezier *sb);
|
void BezierAsPwl(SBezier *sb);
|
||||||
void BezierAsNonrationalCubic(SBezier *sb, int depth=0);
|
void BezierAsNonrationalCubic(SBezier *sb, int depth=0);
|
||||||
|
|
||||||
virtual void StartPath( RgbColor strokeRgb, double lineWidth,
|
virtual void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb) = 0;
|
bool filled, RgbaColor fillRgb) = 0;
|
||||||
virtual void FinishPath(RgbColor strokeRgb, double lineWidth,
|
virtual void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb) = 0;
|
bool filled, RgbaColor fillRgb) = 0;
|
||||||
virtual void Bezier(SBezier *sb) = 0;
|
virtual void Bezier(SBezier *sb) = 0;
|
||||||
virtual void Triangle(STriangle *tr) = 0;
|
virtual void Triangle(STriangle *tr) = 0;
|
||||||
virtual void StartFile(void) = 0;
|
virtual void StartFile(void) = 0;
|
||||||
|
@ -560,10 +560,10 @@ public:
|
||||||
};
|
};
|
||||||
class DxfFileWriter : public VectorFileWriter {
|
class DxfFileWriter : public VectorFileWriter {
|
||||||
public:
|
public:
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -575,10 +575,10 @@ public:
|
||||||
Vector prevPt;
|
Vector prevPt;
|
||||||
void MaybeMoveTo(Vector s, Vector f);
|
void MaybeMoveTo(Vector s, Vector f);
|
||||||
|
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -592,10 +592,10 @@ public:
|
||||||
Vector prevPt;
|
Vector prevPt;
|
||||||
void MaybeMoveTo(Vector s, Vector f);
|
void MaybeMoveTo(Vector s, Vector f);
|
||||||
|
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -607,10 +607,10 @@ public:
|
||||||
Vector prevPt;
|
Vector prevPt;
|
||||||
void MaybeMoveTo(Vector s, Vector f);
|
void MaybeMoveTo(Vector s, Vector f);
|
||||||
|
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -620,10 +620,10 @@ public:
|
||||||
class HpglFileWriter : public VectorFileWriter {
|
class HpglFileWriter : public VectorFileWriter {
|
||||||
public:
|
public:
|
||||||
static double MmToHpglUnits(double mm);
|
static double MmToHpglUnits(double mm);
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -632,10 +632,10 @@ public:
|
||||||
};
|
};
|
||||||
class Step2dFileWriter : public VectorFileWriter {
|
class Step2dFileWriter : public VectorFileWriter {
|
||||||
StepFileWriter sfw;
|
StepFileWriter sfw;
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -645,10 +645,10 @@ class Step2dFileWriter : public VectorFileWriter {
|
||||||
class GCodeFileWriter : public VectorFileWriter {
|
class GCodeFileWriter : public VectorFileWriter {
|
||||||
public:
|
public:
|
||||||
SEdgeList sel;
|
SEdgeList sel;
|
||||||
void StartPath( RgbColor strokeRgb, double lineWidth,
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void FinishPath(RgbColor strokeRgb, double lineWidth,
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
||||||
bool filled, RgbColor fillRgb);
|
bool filled, RgbaColor fillRgb);
|
||||||
void Triangle(STriangle *tr);
|
void Triangle(STriangle *tr);
|
||||||
void Bezier(SBezier *sb);
|
void Bezier(SBezier *sb);
|
||||||
void StartFile(void);
|
void StartFile(void);
|
||||||
|
@ -729,7 +729,7 @@ public:
|
||||||
|
|
||||||
// Little bits of extra configuration state
|
// Little bits of extra configuration state
|
||||||
enum { MODEL_COLORS = 8 };
|
enum { MODEL_COLORS = 8 };
|
||||||
RgbColor modelColor[MODEL_COLORS];
|
RgbaColor modelColor[MODEL_COLORS];
|
||||||
Vector lightDir[2];
|
Vector lightDir[2];
|
||||||
double lightIntensity[2];
|
double lightIntensity[2];
|
||||||
double ambientIntensity;
|
double ambientIntensity;
|
||||||
|
@ -743,7 +743,7 @@ public:
|
||||||
bool drawBackFaces;
|
bool drawBackFaces;
|
||||||
bool checkClosedContour;
|
bool checkClosedContour;
|
||||||
bool showToolbar;
|
bool showToolbar;
|
||||||
RgbColor backgroundColor;
|
RgbaColor backgroundColor;
|
||||||
bool exportShadedTriangles;
|
bool exportShadedTriangles;
|
||||||
bool exportPwlCurves;
|
bool exportPwlCurves;
|
||||||
bool exportCanvasSizeAuto;
|
bool exportCanvasSizeAuto;
|
||||||
|
|
|
@ -489,7 +489,7 @@ typedef struct {
|
||||||
hSSurface hs;
|
hSSurface hs;
|
||||||
} TrimLine;
|
} TrimLine;
|
||||||
|
|
||||||
void SShell::MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, RgbColor color)
|
void SShell::MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, RgbaColor color)
|
||||||
{
|
{
|
||||||
// Make the extrusion direction consistent with respect to the normal
|
// Make the extrusion direction consistent with respect to the normal
|
||||||
// of the sketch we're extruding.
|
// of the sketch we're extruding.
|
||||||
|
@ -608,7 +608,7 @@ typedef struct {
|
||||||
hSSurface d[4];
|
hSSurface d[4];
|
||||||
} Revolved;
|
} Revolved;
|
||||||
|
|
||||||
void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, RgbColor color)
|
void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, RgbaColor color)
|
||||||
{
|
{
|
||||||
SBezierLoop *sbl;
|
SBezierLoop *sbl;
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ public:
|
||||||
// when I copy things over.
|
// when I copy things over.
|
||||||
hSSurface newH;
|
hSSurface newH;
|
||||||
|
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
uint32_t face;
|
uint32_t face;
|
||||||
|
|
||||||
int degm, degn;
|
int degm, degn;
|
||||||
|
@ -361,9 +361,9 @@ public:
|
||||||
bool booleanFailed;
|
bool booleanFailed;
|
||||||
|
|
||||||
void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1,
|
void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1,
|
||||||
RgbColor color);
|
RgbaColor color);
|
||||||
void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
||||||
RgbColor color);
|
RgbaColor color);
|
||||||
|
|
||||||
void MakeFromUnionOf(SShell *a, SShell *b);
|
void MakeFromUnionOf(SShell *a, SShell *b);
|
||||||
void MakeFromDifferenceOf(SShell *a, SShell *b);
|
void MakeFromDifferenceOf(SShell *a, SShell *b);
|
||||||
|
|
|
@ -197,7 +197,7 @@ Style *Style::Get(hStyle h) {
|
||||||
// A couple of wrappers, so that I can call these functions with either an
|
// A couple of wrappers, so that I can call these functions with either an
|
||||||
// hStyle or with the integer corresponding to that hStyle.v.
|
// hStyle or with the integer corresponding to that hStyle.v.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
RgbColor Style::Color(int s, bool forExport) {
|
RgbaColor Style::Color(int s, bool forExport) {
|
||||||
hStyle hs = { (uint32_t)s };
|
hStyle hs = { (uint32_t)s };
|
||||||
return Color(hs, forExport);
|
return Color(hs, forExport);
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ float Style::Width(int s) {
|
||||||
// If a color is almost white, then we can rewrite it to black, just so that
|
// If a color is almost white, then we can rewrite it to black, just so that
|
||||||
// it won't disappear on file formats with a light background.
|
// it won't disappear on file formats with a light background.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
RgbColor Style::RewriteColor(RgbColor rgbin) {
|
RgbaColor Style::RewriteColor(RgbaColor rgbin) {
|
||||||
Vector rgb = Vector::From(rgbin.redF(), rgbin.greenF(), rgbin.blueF());
|
Vector rgb = Vector::From(rgbin.redF(), rgbin.greenF(), rgbin.blueF());
|
||||||
rgb = rgb.Minus(Vector::From(1, 1, 1));
|
rgb = rgb.Minus(Vector::From(1, 1, 1));
|
||||||
if(rgb.Magnitude() < 0.4 && SS.fixExportColors) {
|
if(rgb.Magnitude() < 0.4 && SS.fixExportColors) {
|
||||||
|
@ -227,7 +227,7 @@ RgbColor Style::RewriteColor(RgbColor rgbin) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Return the stroke color associated with our style as 8-bit RGB.
|
// Return the stroke color associated with our style as 8-bit RGB.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
RgbColor Style::Color(hStyle h, bool forExport) {
|
RgbaColor Style::Color(hStyle h, bool forExport) {
|
||||||
Style *s = Get(h);
|
Style *s = Get(h);
|
||||||
if(forExport) {
|
if(forExport) {
|
||||||
return RewriteColor(s->color);
|
return RewriteColor(s->color);
|
||||||
|
@ -239,7 +239,7 @@ RgbColor Style::Color(hStyle h, bool forExport) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Return the fill color associated with our style as 8-bit RGB.
|
// Return the fill color associated with our style as 8-bit RGB.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
RgbColor Style::FillColor(hStyle h, bool forExport) {
|
RgbaColor Style::FillColor(hStyle h, bool forExport) {
|
||||||
Style *s = Get(h);
|
Style *s = Get(h);
|
||||||
if(forExport) {
|
if(forExport) {
|
||||||
return RewriteColor(s->fillColor);
|
return RewriteColor(s->fillColor);
|
||||||
|
@ -349,7 +349,7 @@ void TextWindow::ScreenCreateCustomStyle(int link, uint32_t v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::ScreenChangeBackgroundColor(int link, uint32_t v) {
|
void TextWindow::ScreenChangeBackgroundColor(int link, uint32_t v) {
|
||||||
RgbColor rgb = SS.backgroundColor;
|
RgbaColor rgb = SS.backgroundColor;
|
||||||
SS.TW.ShowEditControlWithColorPicker(v, 3, rgb);
|
SS.TW.ShowEditControlWithColorPicker(v, 3, rgb);
|
||||||
SS.TW.edit.meaning = EDIT_BACKGROUND_COLOR;
|
SS.TW.edit.meaning = EDIT_BACKGROUND_COLOR;
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ void TextWindow::ShowListOfStyles(void) {
|
||||||
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
|
|
||||||
RgbColor rgb = SS.backgroundColor;
|
RgbaColor rgb = SS.backgroundColor;
|
||||||
Printf(false, "%Ft background color (r, g, b)%E");
|
Printf(false, "%Ft background color (r, g, b)%E");
|
||||||
Printf(false, "%Ba %@, %@, %@ %Fl%D%f%Ll[change]%E",
|
Printf(false, "%Ba %@, %@, %@ %Fl%D%f%Ll[change]%E",
|
||||||
rgb.redF(), rgb.greenF(), rgb.blueF(),
|
rgb.redF(), rgb.greenF(), rgb.blueF(),
|
||||||
|
@ -549,7 +549,7 @@ void TextWindow::ScreenChangeStyleColor(int link, uint32_t v) {
|
||||||
Style *s = Style::Get(hs);
|
Style *s = Style::Get(hs);
|
||||||
// Same function used for stroke and fill colors
|
// Same function used for stroke and fill colors
|
||||||
int row, col, em;
|
int row, col, em;
|
||||||
RgbColor rgb;
|
RgbaColor rgb;
|
||||||
if(link == 's') {
|
if(link == 's') {
|
||||||
row = 15; col = 13;
|
row = 15; col = 13;
|
||||||
em = EDIT_STYLE_COLOR;
|
em = EDIT_STYLE_COLOR;
|
||||||
|
|
|
@ -85,7 +85,7 @@ void TextWindow::ShowEditControl(int halfRow, int col, char *s) {
|
||||||
ShowTextEditControl(x - 3, y + 2, s);
|
ShowTextEditControl(x - 3, y + 2, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::ShowEditControlWithColorPicker(int halfRow, int col, RgbColor rgb)
|
void TextWindow::ShowEditControlWithColorPicker(int halfRow, int col, RgbaColor rgb)
|
||||||
{
|
{
|
||||||
char str[1024];
|
char str[1024];
|
||||||
sprintf(str, "%.2f, %.2f, %.2f", rgb.redF(), rgb.greenF(), rgb.blueF());
|
sprintf(str, "%.2f, %.2f, %.2f", rgb.redF(), rgb.greenF(), rgb.blueF());
|
||||||
|
@ -132,7 +132,7 @@ void TextWindow::Printf(bool halfLine, const char *fmt, ...) {
|
||||||
|
|
||||||
char fg = 'd';
|
char fg = 'd';
|
||||||
char bg = 'd';
|
char bg = 'd';
|
||||||
RgbColor bgRgb = RGBi(0, 0, 0);
|
RgbaColor bgRgb = RGBi(0, 0, 0);
|
||||||
int link = NOT_A_LINK;
|
int link = NOT_A_LINK;
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
LinkFunction *f = NULL, *h = NULL;
|
LinkFunction *f = NULL, *h = NULL;
|
||||||
|
@ -203,11 +203,11 @@ void TextWindow::Printf(bool halfLine, const char *fmt, ...) {
|
||||||
case 'F':
|
case 'F':
|
||||||
case 'B': {
|
case 'B': {
|
||||||
char cc = fmt[1]; // color code
|
char cc = fmt[1]; // color code
|
||||||
RgbColor *rgbPtr = NULL;
|
RgbaColor *rgbPtr = NULL;
|
||||||
switch(cc) {
|
switch(cc) {
|
||||||
case 0: goto done; // truncated directive
|
case 0: goto done; // truncated directive
|
||||||
case 'p': cc = (char)va_arg(vl, int); break;
|
case 'p': cc = (char)va_arg(vl, int); break;
|
||||||
case 'z': rgbPtr = va_arg(vl, RgbColor *); break;
|
case 'z': rgbPtr = va_arg(vl, RgbaColor *); break;
|
||||||
}
|
}
|
||||||
if(*fmt == 'F') {
|
if(*fmt == 'F') {
|
||||||
fg = cc;
|
fg = cc;
|
||||||
|
@ -541,7 +541,7 @@ uint8_t *TextWindow::HsvPattern1d(double h, double s) {
|
||||||
|
|
||||||
void TextWindow::ColorPickerDone(void) {
|
void TextWindow::ColorPickerDone(void) {
|
||||||
char str[1024];
|
char str[1024];
|
||||||
RgbColor rgb = editControl.colorPicker.rgb;
|
RgbaColor rgb = editControl.colorPicker.rgb;
|
||||||
sprintf(str, "%.2f, %.2f, %.3f", rgb.redF(), rgb.greenF(), rgb.blueF());
|
sprintf(str, "%.2f, %.2f, %.3f", rgb.redF(), rgb.greenF(), rgb.blueF());
|
||||||
EditControlDone(str);
|
EditControlDone(str);
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown,
|
||||||
if(!editControl.colorPicker.show) return false;
|
if(!editControl.colorPicker.show) return false;
|
||||||
if(how == CLICK || (how == HOVER && leftDown)) InvalidateText();
|
if(how == CLICK || (how == HOVER && leftDown)) InvalidateText();
|
||||||
|
|
||||||
static const RgbColor BaseColor[12] = {
|
static const RgbaColor BaseColor[12] = {
|
||||||
RGBi(255, 0, 0),
|
RGBi(255, 0, 0),
|
||||||
RGBi( 0, 255, 0),
|
RGBi( 0, 255, 0),
|
||||||
RGBi( 0, 0, 255),
|
RGBi( 0, 0, 255),
|
||||||
|
@ -612,7 +612,7 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown,
|
||||||
for(i = 0; i < WIDTH/2; i++) {
|
for(i = 0; i < WIDTH/2; i++) {
|
||||||
for(j = 0; j < HEIGHT; j++) {
|
for(j = 0; j < HEIGHT; j++) {
|
||||||
Vector rgb;
|
Vector rgb;
|
||||||
RgbColor d;
|
RgbaColor d;
|
||||||
if(i == 0 && j < 8) {
|
if(i == 0 && j < 8) {
|
||||||
d = SS.modelColor[j];
|
d = SS.modelColor[j];
|
||||||
rgb = Vector::From(d.redF(), d.greenF(), d.blueF());
|
rgb = Vector::From(d.redF(), d.greenF(), d.blueF());
|
||||||
|
@ -844,7 +844,7 @@ void TextWindow::Paint(void) {
|
||||||
|
|
||||||
int fg = meta[r][c].fg;
|
int fg = meta[r][c].fg;
|
||||||
int bg = meta[r][c].bg;
|
int bg = meta[r][c].bg;
|
||||||
RgbColor bgRgb = meta[r][c].bgRgb;
|
RgbaColor bgRgb = meta[r][c].bgRgb;
|
||||||
|
|
||||||
// On the first pass, all the background quads; on the next
|
// On the first pass, all the background quads; on the next
|
||||||
// pass, all the foreground (i.e., font) quads.
|
// pass, all the foreground (i.e., font) quads.
|
||||||
|
|
8
src/ui.h
8
src/ui.h
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char c;
|
char c;
|
||||||
RgbColor color;
|
RgbaColor color;
|
||||||
} Color;
|
} Color;
|
||||||
static const Color fgColors[];
|
static const Color fgColors[];
|
||||||
static const Color bgColors[];
|
static const Color bgColors[];
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
struct {
|
struct {
|
||||||
char fg;
|
char fg;
|
||||||
char bg;
|
char bg;
|
||||||
RgbColor bgRgb;
|
RgbaColor bgRgb;
|
||||||
int link;
|
int link;
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
LinkFunction *f;
|
LinkFunction *f;
|
||||||
|
@ -199,7 +199,7 @@ public:
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
RgbColor rgb;
|
RgbaColor rgb;
|
||||||
double h, s, v;
|
double h, s, v;
|
||||||
bool show;
|
bool show;
|
||||||
bool picker1dActive;
|
bool picker1dActive;
|
||||||
|
@ -209,7 +209,7 @@ public:
|
||||||
|
|
||||||
void HideEditControl(void);
|
void HideEditControl(void);
|
||||||
void ShowEditControl(int halfRow, int col, char *s);
|
void ShowEditControl(int halfRow, int col, char *s);
|
||||||
void ShowEditControlWithColorPicker(int halfRow, int col, RgbColor rgb);
|
void ShowEditControlWithColorPicker(int halfRow, int col, RgbaColor rgb);
|
||||||
|
|
||||||
void ClearSuper(void);
|
void ClearSuper(void);
|
||||||
|
|
||||||
|
|
|
@ -210,14 +210,14 @@ void SolveSpace::Message(const char *str, ...)
|
||||||
void SolveSpace::CnfFreezeBool(bool v, const char *name)
|
void SolveSpace::CnfFreezeBool(bool v, const char *name)
|
||||||
{ CnfFreezeInt(v ? 1 : 0, name); }
|
{ CnfFreezeInt(v ? 1 : 0, name); }
|
||||||
|
|
||||||
void SolveSpace::CnfFreezeColor(RgbColor v, const char *name)
|
void SolveSpace::CnfFreezeColor(RgbaColor v, const char *name)
|
||||||
{ CnfFreezeInt(v.ToPackedInt(), name); }
|
{ CnfFreezeInt(v.ToPackedInt(), name); }
|
||||||
|
|
||||||
bool SolveSpace::CnfThawBool(bool v, const char *name)
|
bool SolveSpace::CnfThawBool(bool v, const char *name)
|
||||||
{ return CnfThawInt(v ? 1 : 0, name) != 0; }
|
{ return CnfThawInt(v ? 1 : 0, name) != 0; }
|
||||||
|
|
||||||
RgbColor SolveSpace::CnfThawColor(RgbColor v, const char *name)
|
RgbaColor SolveSpace::CnfThawColor(RgbaColor v, const char *name)
|
||||||
{ return RgbColor::FromPackedInt(CnfThawInt(v.ToPackedInt(), name)); }
|
{ return RgbaColor::FromPackedInt(CnfThawInt(v.ToPackedInt(), name)); }
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Solve a mostly banded matrix. In a given row, there are LEFT_OF_DIAG
|
// Solve a mostly banded matrix. In a given row, there are LEFT_OF_DIAG
|
||||||
|
|
Loading…
Reference in New Issue