Longint can also has alpha information, but it is sometimes ignored.
function ARGB(const Alpha, Red, Green, Blue: longint): longint;
begin
Result := (Alpha shl 24) or (Red shl 16) or (Green shl 8) or Blue;
end;
function GetAlpha(const Color: longint): longint;
begin
Result := (Color shr 24) and $FF;
end;
function GetRed(const Color: longint): longint;
begin
Result := (Color shr 16) and $FF;
end;
function GetGreen(const Color: longint): longint;
begin
Result := (Color shr 8) and $FF;
end;
function GetBlue(const Color: longint): longint;
begin
Result := Color and $FF;
end;
procedure ActivateServer();
var
Color, i: longint;
begin
Color := $FFEFDFCF;
WriteLn(InttoStr(GetBlue(Color))); // CF, 207
WriteLn(InttoStr(GetGreen(Color))); // DF, 223
WriteLn(InttoStr(GetRed(Color))); // EF, 239
WriteLn(InttoStr(GetAlpha(Color))); // FF, 255
end;
Some reason when I change the return types to byte, it returns 0. I don't got time to figure out how to fix that atm.
EDIT: Well, some of it I understand... <byte> shr <int> returns byte, but not all of it makes sense to me in the Get<Type> functions