369bde9243
git-svn-id: svn://10.65.10.50/trunk@6251 c028cbd2-c16b-5b4b-a496-9718f37d4682
34 lines
1.0 KiB
C++
Executable File
34 lines
1.0 KiB
C++
Executable File
#include <os_dep.h>
|
|
#include <colors.h>
|
|
|
|
COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
|
|
{
|
|
COLOR def = MAKE_COLOR(red, green, blue);
|
|
|
|
// Se nel colore non compare l'indice cerca di calcolarlo
|
|
const unsigned char color_index = (unsigned char)(def >> 12);
|
|
if (color_index <= 0x0 || color_index > 0xF)
|
|
{
|
|
const COLOR native_color[11] = { COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_CYAN,
|
|
COLOR_MAGENTA, COLOR_YELLOW, COLOR_BLACK, COLOR_DKGRAY,
|
|
COLOR_GRAY, COLOR_LTGRAY, COLOR_WHITE };
|
|
def &= 0x00FFFFFF;
|
|
for (int c = 0; c < 11; c++)
|
|
{
|
|
// Confronta solo la terna R,G,B
|
|
if (def == (native_color[c] & 0x00FFFFFF))
|
|
{
|
|
def = native_color[c];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return def;
|
|
}
|
|
|
|
COLOR choose_color(COLOR col, WINDOW win)
|
|
{
|
|
return os_choose_color(col, win);
|
|
}
|