File: graphicstestunit.pas

package info (click to toggle)
castle-game-engine 6.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 194,520 kB
  • sloc: pascal: 364,585; ansic: 8,606; java: 2,851; objc: 2,601; cpp: 1,412; xml: 851; makefile: 725; sh: 563; php: 26
file content (43 lines) | stat: -rw-r--r-- 718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
unit GraphicsTestUnit;

{$mode objfpc}{$H+}

interface

uses
  Classes, Forms, ExtCtrls, CastleRandom;

type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

uses SysUtils;

{$R *.lfm}

procedure TForm1.FormCreate(Sender: TObject);
var ix, iy: Integer;
    Rnd: TCastleRandom;
begin
  Rnd := TCastleRandom.Create;
  try
    for ix := 0 to Image1.Width do
      for iy := 0 to Image1.Height do
        with Image1.Canvas do begin
          Brush.Color := Round(Rnd.random(255))+256*Round(Rnd.Random(255))+65536*Round(Rnd.Random(255));
          FillRect(ix,iy,ix+1,iy+1);
        end;
  finally
    FreeAndNil(Rnd);
  end;
end;

end.