Delphi Sources

Преобразовать RGB в COLORREF (BGR)



Оформил: DeeCo

function RGB2BGR(R, G, B: Byte): COLORREF; overload;
 begin
   Result := (Integer(B) shl 16) + (Integer(G) shl 8) + R;
 end;

 function RGB2BGR(RGB: Integer): COLORREF; overload;
 var
   R, G, B: Integer;
 begin
   R      := RGB div $10000;
   G      := ((RGB mod $10000) div $100) shl 8;
   B      := (RGB mod $100) shl 16;
   Result := B + G + R;
 end;

Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте