gd-libgd / tests / gdinterpolatedscale / gdModesAndPalettes.c

 ```Chris Reuter f321961 2013-10-23 ``` ``` 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48``` ```/* Exercise all scaling with all interpolation modes and ensure that * at least, something comes back. */ #include #include "gd.h" #include "gdtest.h" #define X 100 #define Y 100 #define NX 20 #define NY 20 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*/ ```