Ejemplo n.º 1
0
BGD_DECLARE(int) gdImageScatter(gdImagePtr im, int sub, int plus)
{
	gdScatter s;

	s.sub  = sub;
	s.plus = plus;
	s.num_colors = 0;
	s.seed = GD_SCATTER_SEED();
	return gdImageScatterEx(im, &s);
}
Ejemplo n.º 2
0
BGD_DECLARE(int) gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors)
{
	gdScatter s;

	s.sub  = sub;
	s.plus = plus;
	s.colors = colors;
	s.num_colors = num_colors;
	s.seed = GD_SCATTER_SEED();
	return gdImageScatterEx(im, &s);
}
Ejemplo n.º 3
0
int main()
{
	gdImagePtr im, ex;
	FILE *fp;
	gdScatter s;
	int colors[] = {0xFF0000, 0x00FF00};
	CuTestImageResult r;

	fp = gdTestFileOpen("gdimagescatterex/bug00208.png");
	im = gdImageCreateFromPng(fp);
	fclose(fp);
	if (!im) {
		fprintf(stderr, "could not create image\n");
		return 1;
	}

	s.sub  = 1;
	s.plus = 3;
	s.seed = 0;
	s.num_colors = 2;
	s.colors = colors;
	if (!gdImageScatterEx(im, &s)) {
		gdImageDestroy(im);
		fprintf(stderr, "could not scatter\n");
		return 1;
	}

	fp = gdTestFileOpen("gdimagescatterex/bug00208_2.png");
	ex = gdImageCreateFromPng(fp);
	fclose(fp);
	if (!ex) {
		fprintf(stderr, "could not create image\n");
		gdImageDestroy(im);
		return 1;
	}
	r.pixels_changed = 0;
	gdTestImageDiff(im, ex, NULL, &r);
	gdImageDestroy(ex);
	gdImageDestroy(im);
	if (r.pixels_changed > 10000) {
		fprintf(stderr, "too much diff: %d\n", r.pixels_changed);
		return 1;
	}
	return 0;
}