Parametric 2d/3d CAD
![]() RGB colors were represented using a uint32_t with the red, green and blue values stuffed into the lower three octets (i.e. 0x00BBGGRR), like Microsoft's COLORREF. This approach did not lend itself to type safety, however, so this change replaces it with an RgbColor class that provides the same infomation plus a handful of useful methods to work with it. (Note that sizeof(RgbColor) == sizeof(uint32_t), so this change should not lead to memory bloat.) Some of the new methods/fields replace what were previously macro calls; e.g. RED(c) is now c.red, REDf(c) is now c.redF(). The .Equals() method is now used instead of == to compare colors. RGB colors still need to be represented as packed integers in file I/O and preferences, so the methods .FromPackedInt() and .ToPackedInt() are provided. Also implemented are Cnf{Freeze,Thaw}Color(), type-safe wrappers around Cnf{Freeze,Thaw}Int() that facilitate I/O with preferences. (Cnf{Freeze,Thaw}Color() are defined outside of the system-dependent code to minimize the footprint of the latter; because the same can be done with Cnf{Freeze,Thaw}Bool(), those are also moved out of the system code with this commit.) Color integers were being OR'ed with 0x80000000 in some places for two distinct purposes: One, to indicate use of a default color in glxFillMesh(); this has been replaced by use of the .UseDefault() method. Two, to indicate to TextWindow::Printf() that the format argument of a "%Bp"/"%Fp" specifier is an RGB color rather than a color "code" from TextWindow::bgColors[] or TextWindow::fgColors[] (as the specifier can accept either); instead, we define a new flag "z" (as in "%Bz" or "%Fz") to indicate an RGBcolor pointer, leaving "%Bp"/"%Fp" to indicate a color code exclusively. (This also allows TextWindow::meta[][].bg to be a char instead of an int, partly compensating for the new .bgRgb field added immediately after.) In array declarations, RGB colors could previously be specified as 0 (often in a terminating element). As that no longer works, we define NULL_COLOR, which serves much the same purpose for RgbColor variables as NULL serves for pointers. |
||
---|---|---|
exposed | ||
extlib | ||
icons | ||
obj | ||
srf | ||
tools | ||
win32 | ||
bitmapextra.table.h | ||
bitmapfont.table.h | ||
bsp.cpp | ||
clipboard.cpp | ||
confscreen.cpp | ||
constraint.cpp | ||
constrainteq.cpp | ||
COPYING.txt | ||
describescreen.cpp | ||
draw.cpp | ||
drawconstraint.cpp | ||
drawentity.cpp | ||
dsc.h | ||
entity.cpp | ||
export.cpp | ||
exportstep.cpp | ||
exportvector.cpp | ||
expr.cpp | ||
expr.h | ||
file.cpp | ||
font.table.h | ||
generate.cpp | ||
glhelper.cpp | ||
graphicswin.cpp | ||
group.cpp | ||
groupmesh.cpp | ||
icon.ico | ||
Makefile.msvc | ||
mesh.cpp | ||
modify.cpp | ||
mouse.cpp | ||
png2c.pl | ||
pngchar2c.pl | ||
polygon.cpp | ||
polygon.h | ||
request.cpp | ||
sketch.h | ||
solvespace.cpp | ||
solvespace.h | ||
style.cpp | ||
system.cpp | ||
textscreens.cpp | ||
textwin.cpp | ||
toolbar.cpp | ||
ttf.cpp | ||
ui.h | ||
undoredo.cpp | ||
util.cpp | ||
view.cpp | ||
wishlist.txt |