📄 color.inc
字号:
{* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Color inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*}
{$IFDEF ALLEGRO_INTERFACE}
function makecol15(r, g, b: sint32): sint32;
function makecol16(r, g, b: sint32): sint32;
function makecol24(r, g, b: sint32): sint32;
function makecol32(r, g, b: sint32): sint32;
function makeacol32(r, g, b, a: sint32): sint32;
function getr8(c: sint32): sint32;
function getg8(c: sint32): sint32;
function getb8(c: sint32): sint32;
function getr15(c: sint32): sint32;
function getg15(c: sint32): sint32;
function getb15(c: sint32): sint32;
function getr16(c: sint32): sint32;
function getg16(c: sint32): sint32;
function getb16(c: sint32): sint32;
function getr24(c: sint32): sint32;
function getg24(c: sint32): sint32;
function getb24(c: sint32): sint32;
function getr32(c: sint32): sint32;
function getg32(c: sint32): sint32;
function getb32(c: sint32): sint32;
function geta32(c: sint32): sint32;
{$ENDIF ALLEGRO_INTERFACE}
{$IFDEF ALLEGRO_IMPLEMENTATION}
function makecol15(r, g, b: sint32): sint32;
begin
Result := (((r shr 3) shl _rgb_r_shift_15^) or
((g shr 3) shl _rgb_g_shift_15^) or
((b shr 3) shl _rgb_b_shift_15^));
end;
function makecol16(r, g, b: sint32): sint32;
begin
Result := (((r shr 3) shl _rgb_r_shift_16^) or
((g shr 2) shl _rgb_g_shift_16^) or
((b shr 3) shl _rgb_b_shift_16^));
end;
function makecol24(r, g, b: sint32): sint32;
begin
Result := ((r shl _rgb_r_shift_24^) or
(g shl _rgb_g_shift_24^) or
(b shl _rgb_b_shift_24^));
end;
function makecol32(r, g, b: sint32): sint32;
begin
Result := ((r shl _rgb_r_shift_32^) or
(g shl _rgb_g_shift_32^) or
(b shl _rgb_b_shift_32^));
end;
function makeacol32(r, g, b, a: sint32): sint32;
begin
Result := ((r shl _rgb_r_shift_32^) or
(g shl _rgb_g_shift_32^) or
(b shl _rgb_b_shift_32^) or
(a shl _rgb_a_shift_32^));
end;
function getr8(c: sint32): sint32;
begin
Result := _rgb_scale_6^[_current_palette^[c].r];
end;
function getg8(c: sint32): sint32;
begin
Result := _rgb_scale_6^[_current_palette^[c].g];
end;
function getb8(c: sint32): sint32;
begin
Result := _rgb_scale_6^[_current_palette^[c].b];
end;
function getr15(c: sint32): sint32;
begin
Result := _rgb_scale_5^[(c shr _rgb_r_shift_15^) and $1F];
end;
function getg15(c: sint32): sint32;
begin
Result := _rgb_scale_5^[(c shr _rgb_g_shift_15^) and $1F];
end;
function getb15(c: sint32): sint32;
begin
Result := _rgb_scale_5^[(c shr _rgb_b_shift_15^) and $1F];
end;
function getr16(c: sint32): sint32;
begin
Result := _rgb_scale_5^[(c shr _rgb_r_shift_16^) and $1F];
end;
function getg16(c: sint32): sint32;
begin
Result := _rgb_scale_6^[(c shr _rgb_g_shift_16^) and $3F];
end;
function getb16(c: sint32): sint32;
begin
Result := _rgb_scale_5^[(c shr _rgb_b_shift_16^) and $1F];
end;
function getr24(c: sint32): sint32;
begin
Result := ((c shr _rgb_r_shift_24^) and $FF);
end;
function getg24(c: sint32): sint32;
begin
Result := ((c shr _rgb_g_shift_24^) and $FF);
end;
function getb24(c: sint32): sint32;
begin
Result := ((c shr _rgb_b_shift_24^) and $FF);
end;
function getr32(c: sint32): sint32;
begin
Result := ((c shr _rgb_r_shift_32^) and $FF);
end;
function getg32(c: sint32): sint32;
begin
Result := ((c shr _rgb_g_shift_32^) and $FF);
end;
function getb32(c: sint32): sint32;
begin
Result := ((c shr _rgb_b_shift_32^) and $FF);
end;
function geta32(c: sint32): sint32;
begin
Result := ((c shr _rgb_a_shift_32^) and $FF);
end;
{$ENDIF ALLEGRO_IMPLEMENTATION}
{$IFDEF ALLEGRO_LOADVARIABLE}
{$ENDIF ALLEGRO_LOADVARIABLE}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -