1 { Copyright (C) 2008 Peter Green
\r
2 For conditions of distribution and use, see copyright notice in zlib_license.txt
\r
3 which is included in the package
\r
4 ----------------------------------------------------------------------------- }
\r
6 //test program for png code, uses ct8bp mode to draw a red and white heart
\r
7 //in 1 2 4 and 8 bit per pixel modes.
\r
12 pngwrite,classes,sysutils;
\r
16 imagedata : array[0..10] of array [0..10] of byte=(
\r
17 (0,0,0,0,0,0,0,0,0,0,0),
\r
18 (0,0,1,1,1,0,1,1,1,0,0),
\r
19 (0,1,1,1,1,0,1,1,1,1,0),
\r
20 (0,1,1,1,1,1,1,1,1,1,0),
\r
21 (0,1,1,1,1,1,1,1,1,1,0),
\r
22 (0,1,1,1,1,1,1,1,1,1,0),
\r
23 (0,0,1,1,1,1,1,1,1,0,0),
\r
24 (0,0,0,1,1,1,1,1,0,0,0),
\r
25 (0,0,0,0,1,1,1,0,0,0,0),
\r
26 (0,0,0,0,0,1,0,0,0,0,0),
\r
27 (0,0,0,0,0,0,0,0,0,0,0)
\r
29 paldata : array[0..5] of byte=(255,255,255,255,0,0);
\r
31 outer,counter : integer;
\r
32 stream : tfilestream;
\r
35 for outer := 0 to 3 do begin
\r
37 stream := tfilestream.Create('heart'+inttostr(1 shl outer)+'.png',fmCreate{fmOpenWrite} or fmShareDenyNone );
\r
39 pngstart(f,stream,1 shl outer,ct8bp,11,11);
\r
40 pngwritepal(f,@paldata,2);
\r
43 for counter := 0 to 10 do begin
\r
44 pngwritescanline(f,@imagedata[counter]);
\r