Skip to content

Instantly share code, notes, and snippets.

@freeonterminate
Last active December 31, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freeonterminate/7999844 to your computer and use it in GitHub Desktop.
Save freeonterminate/7999844 to your computer and use it in GitHub Desktop.
ARGB でも ABGR でも正しい色を返す
// ARGB を ABGR に変換
// IsRev が True の時 ABGR(PixelFormat が pfA8B8G8R8)
function GetColor(const iColor: TAlphaColor): TAlphaColor;
{$IFDEF CPUX86}
asm
cmp byte ptr IsRev, 0
jz @@exit
rol eax, 8
bswap eax
@@exit:
end;
{$ELSE}
begin
if (IsRev) then
Result := RGBtoBGR(iColor) // System.UIConst に定義
else
Result := iColor;
end;
{$ENDIF}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment