leocad/common/lc_colors.h

80 lines
1.7 KiB
C
Raw Normal View History

#pragma once
2013-08-09 06:57:18 +02:00
2013-08-16 01:43:18 +02:00
#include "lc_array.h"
2015-05-04 02:51:41 +02:00
#include "lc_math.h"
2013-08-09 06:57:18 +02:00
#define LC_MAX_COLOR_NAME 64
#define LC_COLOR_DIRECT 0x80000000
struct lcColor
{
2017-12-02 21:22:04 +01:00
quint32 Code;
2013-08-09 06:57:18 +02:00
bool Translucent;
2015-05-04 02:51:41 +02:00
lcVector4 Value;
lcVector4 Edge;
2013-08-09 06:57:18 +02:00
char Name[LC_MAX_COLOR_NAME];
char SafeName[LC_MAX_COLOR_NAME];
};
enum
{
LC_COLORGROUP_SOLID,
LC_COLORGROUP_TRANSLUCENT,
LC_COLORGROUP_SPECIAL,
LC_NUM_COLORGROUPS
};
struct lcColorGroup
{
2019-07-05 02:06:26 +02:00
std::vector<int> Colors;
2015-11-30 20:32:33 +01:00
QString Name;
2013-08-09 06:57:18 +02:00
};
2015-05-04 02:51:41 +02:00
enum lcInterfaceColor
{
LC_COLOR_SELECTED,
LC_COLOR_FOCUSED,
LC_COLOR_DISABLED,
2015-05-04 02:51:41 +02:00
LC_COLOR_CAMERA,
LC_COLOR_LIGHT,
2016-03-12 01:38:02 +01:00
LC_COLOR_CONTROL_POINT,
LC_COLOR_CONTROL_POINT_FOCUSED,
LC_COLOR_HIGHLIGHT,
2015-05-04 02:51:41 +02:00
LC_NUM_INTERFACECOLORS
};
extern lcVector4 gInterfaceColors[LC_NUM_INTERFACECOLORS];
2019-07-05 02:06:26 +02:00
extern std::vector<lcColor> gColorList;
2013-08-09 06:57:18 +02:00
extern lcColorGroup gColorGroups[LC_NUM_COLORGROUPS];
extern int gNumUserColors;
extern int gEdgeColor;
extern int gDefaultColor;
void lcLoadDefaultColors();
bool lcLoadColorFile(lcFile& File);
2017-12-02 21:22:04 +01:00
int lcGetColorIndex(quint32 ColorCode);
2013-08-09 06:57:18 +02:00
int lcGetBrickLinkColor(int ColorIndex);
2017-12-02 21:22:04 +01:00
inline quint32 lcGetColorCodeFromExtendedColor(int Color)
2013-08-09 06:57:18 +02:00
{
const int ConverstionTable[] = { 4, 12, 2, 10, 1, 9, 14, 15, 8, 0, 6, 13, 13, 334, 36, 44, 34, 42, 33, 41, 46, 47, 7, 382, 6, 13, 11, 383 };
return ConverstionTable[Color];
}
2017-12-02 21:22:04 +01:00
inline quint32 lcGetColorCodeFromOriginalColor(int Color)
2013-08-09 06:57:18 +02:00
{
const int ConverstionTable[] = { 0, 2, 4, 9, 7, 6, 22, 8, 10, 11, 14, 16, 18, 9, 21, 20, 22, 8, 10, 11 };
return lcGetColorCodeFromExtendedColor(ConverstionTable[Color]);
}
2017-12-02 21:22:04 +01:00
inline quint32 lcGetColorCode(int ColorIndex)
2013-08-09 06:57:18 +02:00
{
return gColorList[ColorIndex].Code;
}
inline bool lcIsColorTranslucent(int ColorIndex)
{
return gColorList[ColorIndex].Translucent;
}