1 /**
2  * Regression test for <https://github.com/libgd/libgd/issues/315>
3  *
4  * We're testing that a single-pointed gdImageAALine() is drawn as a single
5  * non-antialized pixel, according to (two-pointed) vertical and horizontal
6  * lines.
7  */
8 
9 #include "gd.h"
10 #include "gdtest.h"
11 
main()12 int main()
13 {
14 	gdImagePtr im;
15 	int white, black;
16 	char *path;
17 
18 	im = gdImageCreateTrueColor(6, 6);
19 	white = gdImageColorAllocate(im, 255, 255, 255);
20 	black = gdImageColorAllocate(im, 0, 0, 0);
21 	gdImageFilledRectangle(im, 0,0, 5,5, white);
22 
23 	gdImageLine(im, 4,4, 4,4, black);
24 	gdImageLine(im, 1,4, 2,4, black);
25 	gdImageLine(im, 4,1, 4,2, black);
26 
27 	gdImageSetAntiAliased(im, black);
28 	gdImageLine(im, 1,1, 1,1, gdAntiAliased);
29 
30 	path = gdTestFilePath2("gdimageline", "bug00315_exp.png");
31 	gdAssertImageEqualsToFile(path, im);
32 	gdFree(path);
33 
34 	gdImageDestroy(im);
35 
36 	return gdNumFailures();
37 }
38