cvs: gd /libgd/examples CMakeLists.txt gif.c

From: Date: Tue, 22 Jan 2008 17:46:03 +0000
Subject: cvs: gd /libgd/examples CMakeLists.txt gif.c
Groups: php.gd.cvs 
Request: Send a blank email to php-gd-cvs+get-421@lists.php.net to get a copy of this message
pajoye Tue Jan 22 17:46:03 2008 UTC Added files: /gd/libgd/examples gif.c Modified files: /gd/libgd/examples CMakeLists.txt Log: - add animated GIF example with a palette per frame (local palette) http://cvs.php.net/viewvc.cgi/gd/libgd/examples/CMakeLists.txt?r1=1.6&r2=1.7&diff_format=u Index: gd/libgd/examples/CMakeLists.txt diff -u gd/libgd/examples/CMakeLists.txt:1.6 gd/libgd/examples/CMakeLists.txt:1.7 --- gd/libgd/examples/CMakeLists.txt:1.6 Tue Jan 15 23:23:06 2008 +++ gd/libgd/examples/CMakeLists.txt Tue Jan 22 17:46:02 2008 @@ -5,7 +5,8 @@ SET(TESTS_FILES tgaread crop - nnquant + nnquant + gif ) if (WIN32) http://cvs.php.net/viewvc.cgi/gd/libgd/examples/gif.c?view=markup&rev=1.1 Index: gd/libgd/examples/gif.c +++ gd/libgd/examples/gif.c #include <stdio.h> #include <stdlib.h> #include <gd.h> int main(int argc, char ** argv) { int i; FILE * out; gdImagePtr im; gdImagePtr prev =NULL; int white, black; im = gdImageCreate(100, 100); if (!im) { fprintf(stderr, "can't create image"); return 1; } out = fopen("anim.gif", "wb"); if (!out) { fprintf(stderr, "can't create file %s", "anim.gif"); return 1; } white = gdImageColorAllocate(im, 255, 255, 255); gdImageGifAnimBegin(im, out, 1, -1); for(i = 0; i < 20; i++) { int r,g,b; im = gdImageCreate(100, 100); r = rand() % 255; g = rand() % 255; b = rand() % 255; white = gdImageColorAllocate(im, 255, 255, 255); black = gdImageColorAllocate(im, r, g, b); printf("(%i, %i, %i)\n",r, g, b); gdImageFilledRectangle(im, rand() % 100, rand() % 100, rand() % 100, rand() % 100, black); gdImageGifAnimAdd(im, out, 1, 0, 0, 10, 1, prev); if(prev) { gdImageDestroy(prev); } prev = im; } gdImageGifAnimEnd(out); fclose(out); return 0; }

« previous php.gd.cvs (#421) next »