29 lines
682 B
ObjectPascal
29 lines
682 B
ObjectPascal
unit GraphicsEx;
|
|
//version 0.1
|
|
{$MODE Delphi}
|
|
{$codepage UTF8}
|
|
interface
|
|
uses Classes, SysUtils, Graphics;
|
|
type TRGBByte = 0..255;
|
|
TRGBColor = record
|
|
R, G, B: TRGBByte;
|
|
end;
|
|
//stdcalls
|
|
function RGB2Color (const ARGB: TRGBColor): TColor;
|
|
function Color2RGB (const AColor: TColor): TRGBColor;
|
|
implementation
|
|
function RGB2Color (const ARGB: TRGBColor): TColor;
|
|
begin
|
|
Result:= RGBToColor(ARGB.R, ARGB.G, ARGB.B);
|
|
end;
|
|
function Color2RGB (const AColor: TColor): TRGBColor;
|
|
//from http://www.delphisources.ru/pages/faq/base/rgb_tcolor.html
|
|
var Color: LongInt;
|
|
begin
|
|
Color:= ColorToRGB(AColor);
|
|
Result.R:= Color;
|
|
Result.G:= Color shr 8;
|
|
Result.B:= Color shr 16;
|
|
end;
|
|
end.
|