summaryrefslogtreecommitdiff
path: root/packages/extra/ptc/test/view.pp
blob: 4f83c65bc3e08c59eec892f0560a84b395d15342 (plain)
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
44
45
46
47
{$MODE objfpc}

Uses
  SysUtils, ptc;

Var
  console : TPTCConsole;
  surface : TPTCSurface;
  format : TPTCFormat;
  pixels : Pint32;
  width, height : Integer;
  I : Integer;
  F : File;

Begin
  Try
    console := TPTCConsole.Create;

    format := TPTCFormat.Create(24, $00FF0000, $0000FF00, $000000FF);
    surface := TPTCSurface.Create(320, 200, format);

    console.open('Random example', surface.width, surface.height, format);

    format.Free;
    
    For I := 1 To 100 Do
    Begin
      Writeln('test', I, '.raw');
      ASSign(F, 'test' + IntToStr(I) + '.raw');
      Reset(F, 1);
      BlockRead(F, surface.lock^, surface.height * surface.pitch);
      surface.unlock;
      Close(F);
      surface.copy(console);
      console.update;
      console.read.Free;
    End;

    console.close;
    console.Free;
    surface.Free;
  Except
    On error : TPTCError Do
      { report error }
      error.report;
  End;
End.