int main() { gdImagePtr im; int black; FILE *outFile; gdIOCtx *out; off_t length; /* create the test image */ im = gdImageCreate(11, 11); gdImageColorAllocate(im, 255, 255, 255); black = gdImageColorAllocate(im, 0, 0, 0); gdImageArc(im, 5, 5, 10, 10, 0, 360, black); /* write the file to disk, note the file length and delete the file */ outFile = gdTestTempFp(); out = gdNewFileCtx(outFile); gdTestAssert(out != NULL); gdImageXbmCtx(im, "github_bug_170.xbm", 1, out); out->gd_free(out); length = ftello(outFile); fclose(outFile); gdImageDestroy(im); gdTestAssertMsg(length == 250, "expected to write 250 bytes; %jd bytes written", (intmax_t) length); return gdNumFailures(); }
int main() { int method, i; for(method = GD_BELL; method <= GD_TRIANGLE; method++) { /* GD_WEIGHTED4 is unsupported. */ gdImagePtr im[2]; // printf("Method = %d\n", method); im[0] = gdImageCreateTrueColor(X, Y); im[1] = gdImageCreatePalette(X, Y); for (i = 0; i < 2; i++) { gdImagePtr result; // printf(" %s\n", i == 0 ? "truecolor" : "palette"); gdImageFilledRectangle(im[i], 0, 0, X-1, Y-1, gdImageColorExactAlpha(im[i], 255, 255, 255, 0)); gdImageSetInterpolationMethod(im[i], method); gdTestAssert(im[i]->interpolation_id == method); /* No getter yet. */ result = gdImageScale(im[i], NX, NY); gdTestAssert(result != NULL); gdTestAssert(result != im[i]); gdTestAssert(result->sx == NX && result->sy == NY); gdImageDestroy(result); gdImageDestroy(im[i]); }/* for */ }/* for*/ return gdNumFailures(); }/* main*/
int main() { gdImagePtr im; int white, black; char *path; im = gdImageCreateTrueColor(6, 6); white = gdImageColorAllocate(im, 255, 255, 255); black = gdImageColorAllocate(im, 0, 0, 0); gdImageFilledRectangle(im, 0,0, 5,5, white); gdImageLine(im, 4,4, 4,4, black); gdImageLine(im, 1,4, 2,4, black); gdImageLine(im, 4,1, 4,2, black); gdImageSetAntiAliased(im, black); gdImageLine(im, 1,1, 1,1, gdAntiAliased); path = gdTestFilePath2("gdimageline", "bug00315_exp.png"); gdAssertImageEqualsToFile(path, im); gdFree(path); gdImageDestroy(im); return gdNumFailures(); }
int main(int argc, char **argv) { do_test(300, 300, 600, 600); do_test(3200, 2133, 640, 427); return gdNumFailures(); }
int main() { gdImagePtr im; FILE *fp = gdTestFileOpen("tga/bug00247.tga"); im = gdImageCreateFromTga(fp); gdTestAssert(im == NULL); fclose(fp); return gdNumFailures(); }
int main() { gdImagePtr im; int transparent, color; im = gdImageCreateTrueColor(100, 100); transparent = gdImageColorAllocateAlpha(im, 255, 255, 255, 80); gdImageFilledRectangle(im, 0,0, 99,99, transparent); color = gdImageColorAllocateAlpha(im, 0, 255, 0, 100); gdImageFilledArc(im, 49,49, 99,99, 0,360, color, gdPie); gdAssertImageEqualsToFile("gdimagefilledarc/php_bug43828_exp.png", im); gdImageDestroy(im); return gdNumFailures(); }
int main() { gdImagePtr im; void *data; int size = 0; im = gdImageCreate(100, 100); gdTestAssert(im != NULL); data = gdImagePngPtr(im, &size); gdTestAssert(data == NULL); gdImageDestroy(im); return gdNumFailures(); }
int main() { gdImagePtr im; FILE *fp; fp = gdTestFileOpen2("gd2", "bug00354a.gd2"); gdTestAssert(fp != NULL); im = gdImageCreateFromGd2(fp); gdTestAssert(im == NULL); fclose(fp); fp = gdTestFileOpen2("gd2", "bug00354b.gd2"); gdTestAssert(fp != NULL); im = gdImageCreateFromGd2(fp); gdTestAssert(im == NULL); fclose(fp); return gdNumFailures(); }
int main() { gdImagePtr im; FILE *fp; char *path; fp = gdTestFileOpen2("xbm", "x10_basic_read.xbm"); im = gdImageCreateFromXbm(fp); fclose(fp); gdTestAssert(im != NULL); path = gdTestFilePath2("xbm", "x10_basic_read_exp.png"); gdAssertImageEqualsToFile(path, im); gdFree(path); gdImageDestroy(im); return gdNumFailures(); }
int main() { gdImagePtr im; FILE *fp; void *data; int size = 0; fp = gdTestFileOpen2("png", "bug00381_2.gd"); gdTestAssert(fp != NULL); im = gdImageCreateFromGd(fp); gdTestAssert(im != NULL); fclose(fp); data = gdImagePngPtr(im, &size); gdTestAssert(data == NULL); gdImageDestroy(im); return gdNumFailures(); }