[Delphi-początkujący] Kolory.

0

Witam.
Mam pewien łatwy, a zarazem trudny(dla mnie) problem.
Otóż, chciałbym kodowo zmienić kolor hex-owy na kolor w takowej postaci: 0x00000000 .

Nie mam pojęcia jak się zabrać do tego, i... no i tyle. Mam nadzieję że ktoś odpisze.
(czytałem że jeden to nasycenie, etc. ale nie pomogło...)

Z góry dziękuje

0

Color:

  • $AABBGGRR (Delphi)
  • 0xAABBGGRR (C++)

A - Alpha transparency
B - Blue
G - Green
R - Red

Czyli, jeśli masz w hex'ie czarny: 00000000 to wystarczy dodać '0x' przed: 0x00000000.

F1 [Help]:
If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green, and red, respectively. The value $00FF0000 (Delphi) or 0x00FF0000 (C++) represents full-intensity, pure blue, $0000FF00 (Delphi) or 0x0000FF00 (C++) is pure green, and $000000FF (Delphi) or 0x000000FF (C++) is pure red. $00000000 (Delphi) or 0x00000000 (C++) is black and $00FFFFFF (Delphi) or 0x00FFFFFF (C++) is white.

0

Ja bym to tak zrobił:

program Project1;
{$APPTYPE CONSOLE}
uses
  SysUtils,Graphics;
var
  c : TColor;
begin
  c := clRed;
  Writeln(Format('0x%p',[Pointer(c)]));
  Readln;
end.

1 użytkowników online, w tym zalogowanych: 0, gości: 1