summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-2.1.1/tests/gdimagefill/bug00002_4.c
blob: 4b11d84bdc990e262fe1f827b91c7d56b808bb50 (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
/*ImageFill Pattern fill */

#include "gd.h"
#include "gdtest.h"

int main()
{
	gdImagePtr im;
	int red, blue, white, black, error = 0;
	char path[1024];

	im = gdImageCreate(50,100);
	red = gdImageColorAllocate(im, 255, 0, 0);
	blue = gdImageColorAllocate(im, 0,0,255);
	white  = gdImageColorAllocate(im, 255,255,255);
	black = gdImageColorAllocate(im, 0,0,0);
	gdImageFill(im, 0,0, black);

	gdImageLine(im, 20,20,180,20, white);
	gdImageLine(im, 20,20,20,70, blue);
	gdImageLine(im, 20,70,180,70, red);
	gdImageLine(im, 180,20,180,45, white);
	gdImageLine(im, 180,70,180,45, red);
	gdImageLine(im, 20,20,100,45, blue);
	gdImageLine(im, 20,70,100,45, blue);
	gdImageLine(im, 100,45,180,45, red);

	gdImageFill(im, 21,45, blue);
	gdImageFill(im, 100,69, red);
	gdImageFill(im, 100,21, white);

	sprintf(path, "%s/gdimagefill/bug00002_4_exp.png", GDTEST_TOP_DIR);
	if (!gdAssertImageEqualsToFile(path, im)) {
		error = 1;
	}

	/* Destroy it */
	gdImageDestroy(im);
	return error;
}