0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.119.109.60


Current Path : /var/www/html/suk_discontinued/libgd-gd-2.2.3/tests/gdimagerotate/
Upload File :
Current File : /var/www/html/suk_discontinued/libgd-gd-2.2.3/tests/gdimagerotate/bug00067.c

#include <stdio.h>
#include <stdlib.h>
#include "gd.h"

#include "gdtest.h"

int main()
{
	gdImagePtr im, exp;
	char *path, filename[2048];
	const char *file_im = "gdimagerotate/remirh128.png";
	FILE *fp;
	int color;
	int error = 0;
	int angle;

	fp = gdTestFileOpen(file_im);
	im = gdImageCreateFromPng(fp);
	fclose(fp);

	if (!im) {
		gdTestErrorMsg("loading %s failed.\n", file_im);
		return 1;
	}

	color = gdImageColorAllocateAlpha(im, 255, 255, 255, 127);

	if (color < 0) {
		gdTestErrorMsg("allocation color from image failed.\n");
		gdImageDestroy(im);
		return 1;
	}

	for (angle = 0; angle <= 180; angle += 15) {

		exp = gdImageRotateInterpolated(im, angle, color);

		if (!exp) {
			gdTestErrorMsg("rotating image failed for %03d.\n", angle);
			gdImageDestroy(im);
			return 1;
		}

		sprintf(filename, "bug00067_%03d_exp.png", angle);
		path = gdTestFilePath2("gdimagerotate", filename);
		if (!gdAssertImageEqualsToFile(path, exp)) {
			gdTestErrorMsg("comparing rotated image to %s failed.\n", path);
			error += 1;
		}
		free(path);

		gdImageDestroy(exp);
	}

	gdImageDestroy(im);

	return error;
}