var Bitmap: TBitmap;
procedure TForm1.FormCreate(Sender: TObject);
var Offset, Value, Index: Cardinal;
begin
Bitmap := TBitmap.Create;
Bitmap.Width := 255 * 3;
Bitmap.Height := 1;
Offset := 0;
Value := 255; for Index := 0 to 255 * 3 - 1 do
begin
Bitmap.Canvas.Pixels[Index, 0] := Value;
Dec(PByte(Cardinal(@Value) + (Offset mod 3))^);
Inc(PByte(Cardinal(@Value) + ((Offset + 1) mod 3))^);
if ((Index + 1) mod 255) = 0 then
Inc(Offset);
end;
end;
procedure TForm1.FormPaint(Sender: TObject); begin
SetStretchBltMode(Canvas.Handle, COLORONCOLOR);
StretchBlt(Canvas.Handle, 0, 0, ClientWidth, ClientHeight, Bitmap.Canvas.Handle, 0, 0, 255 * 3, 1, SRCCOPY);
end;