summaryrefslogtreecommitdiff
path: root/tests/gdimagesetpixel/gdeffectmultiply.c
blob: 3d8da7bfe29856dcb0c8e696ac7893f4b121d778 (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
#include "gd.h"
#include "gdtest.h"

int main()
{
	gdImagePtr im;
	int x, y, c;
	int r=0;


	im = gdImageCreateTrueColor(256, 256);
	gdImageAlphaBlending( im, gdEffectReplace );
	for (x=0; x<256; x++) {
		for (y=0; y<256; y++) {
			c = (y/2 << 24) + (x << 16) + (x << 8) + x;
			gdImageSetPixel(im, x, y, c );
		}
	}
	gdImageAlphaBlending( im, gdEffectMultiply );
	gdImageFilledRectangle(im, 0, 0, 255, 255, 0xff7f00);

	if (gdTrueColorGetGreen(gdImageGetPixel(im, 0, 128)) != 0x40) {
		r = 1;
	}
	if (gdTrueColorGetGreen(gdImageGetPixel(im, 128, 128)) != 0x5f) {
		r = 1;
	}
	if (gdTrueColorGetGreen(gdImageGetPixel(im, 255, 128)) != 0x7f) {
		r = 1;
	}
	gdImageDestroy(im);
	return r;
}