24 #include "ldconfig.h" |
24 #include "ldconfig.h" |
25 #include <QColor> |
25 #include <QColor> |
26 |
26 |
27 static LDColor* g_LDColors[MAX_COLORS]; |
27 static LDColor* g_LDColors[MAX_COLORS]; |
28 |
28 |
|
29 // ============================================================================= |
|
30 // ----------------------------------------------------------------------------- |
29 void initColors() { |
31 void initColors() { |
30 LDColor* col; |
32 LDColor* col; |
31 print ("%1: initializing color information.\n", __func__); |
33 print ("%1: initializing color information.\n", __func__); |
32 |
34 |
33 // Always make sure there's 16 and 24 available. They're special like that. |
35 // Always make sure there's 16 and 24 available. They're special like that. |
63 |
65 |
64 g_LDColors[colnum] = col; |
66 g_LDColors[colnum] = col; |
65 } |
67 } |
66 |
68 |
67 // ============================================================================= |
69 // ============================================================================= |
68 uchar luma (QColor& col) { |
70 // ----------------------------------------------------------------------------- |
|
71 int luma (QColor& col) { |
69 return (0.2126f * col.red()) + |
72 return (0.2126f * col.red()) + |
70 (0.7152f * col.green()) + |
73 (0.7152f * col.green()) + |
71 (0.0722f * col.blue()); |
74 (0.0722f * col.blue()); |
72 } |
75 } |