diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-23 22:27:27 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-23 22:27:27 +0200 |
commit | c1804def24eab07dd786e654d153583bf5923441 (patch) | |
tree | d7b9283ffe6760c0ff494904cc91032850d824e6 /src/gd_gif_out.c | |
parent | 4778a8a9460d6377c0041e5c6c5f3c1f842f409a (diff) | |
download | libgd-c1804def24eab07dd786e654d153583bf5923441.tar.gz |
Mark up code examples with (start|end code)
This makes the code better readable in the sources, and we get syntax
highlighting in the generated HTML wherever we want it (i.e. not necessarily
always as with `-hl all`).
Diffstat (limited to 'src/gd_gif_out.c')
-rw-r--r-- | src/gd_gif_out.c | 90 |
1 files changed, 46 insertions, 44 deletions
diff --git a/src/gd_gif_out.c b/src/gd_gif_out.c index c35db28..6fe707d 100644 --- a/src/gd_gif_out.c +++ b/src/gd_gif_out.c @@ -540,50 +540,52 @@ BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, Nothing. Example: - - > { - > gdImagePtr im, im2, im3; - > int black, white, trans; - > FILE *out; - > - > im = gdImageCreate(100, 100); // Create the image - > white = gdImageColorAllocate(im, 255, 255, 255); // Allocate background - > black = gdImageColorAllocate(im, 0, 0, 0); // Allocate drawing color - > trans = gdImageColorAllocate(im, 1, 1, 1); // trans clr for compression - > gdImageRectangle(im, 0, 0, 10, 10, black); // Draw rectangle - > - > out = fopen("anim.gif", "wb");// Open output file in binary mode - > gdImageGifAnimBegin(im, out, 1, 3);// Write GIF hdr, global clr map,loops - > // Write the first frame. No local color map. Delay = 1s - > gdImageGifAnimAdd(im, out, 0, 0, 0, 100, 1, NULL); - > - > // construct the second frame - > im2 = gdImageCreate(100, 100); - > (void)gdImageColorAllocate(im2, 255, 255, 255); // White background - > gdImagePaletteCopy (im2, im); // Make sure the palette is identical - > gdImageRectangle(im2, 0, 0, 15, 15, black); // Draw something - > // Allow animation compression with transparent pixels - > gdImageColorTransparent (im2, trans); - > gdImageGifAnimAdd(im2, out, 0, 0, 0, 100, 1, im); // Add second frame - > - > // construct the third frame - > im3 = gdImageCreate(100, 100); - > (void)gdImageColorAllocate(im3, 255, 255, 255); // white background - > gdImagePaletteCopy (im3, im); // Make sure the palette is identical - > gdImageRectangle(im3, 0, 0, 15, 20, black); // Draw something - > // Allow animation compression with transparent pixels - > gdImageColorTransparent (im3, trans); - > // Add the third frame, compressing against the second one - > gdImageGifAnimAdd(im3, out, 0, 0, 0, 100, 1, im2); - > gdImageGifAnimEnd(out); // End marker, same as putc(';', out); - > fclose(out); // Close file - > - > // Destroy images - > gdImageDestroy(im); - > gdImageDestroy(im2); - > gdImageDestroy(im3); - > } - + (start code) + + { + gdImagePtr im, im2, im3; + int black, white, trans; + FILE *out; + + im = gdImageCreate(100, 100); // Create the image + white = gdImageColorAllocate(im, 255, 255, 255); // Allocate background + black = gdImageColorAllocate(im, 0, 0, 0); // Allocate drawing color + trans = gdImageColorAllocate(im, 1, 1, 1); // trans clr for compression + gdImageRectangle(im, 0, 0, 10, 10, black); // Draw rectangle + + out = fopen("anim.gif", "wb");// Open output file in binary mode + gdImageGifAnimBegin(im, out, 1, 3);// Write GIF hdr, global clr map,loops + // Write the first frame. No local color map. Delay = 1s + gdImageGifAnimAdd(im, out, 0, 0, 0, 100, 1, NULL); + + // construct the second frame + im2 = gdImageCreate(100, 100); + (void)gdImageColorAllocate(im2, 255, 255, 255); // White background + gdImagePaletteCopy (im2, im); // Make sure the palette is identical + gdImageRectangle(im2, 0, 0, 15, 15, black); // Draw something + // Allow animation compression with transparent pixels + gdImageColorTransparent (im2, trans); + gdImageGifAnimAdd(im2, out, 0, 0, 0, 100, 1, im); // Add second frame + + // construct the third frame + im3 = gdImageCreate(100, 100); + (void)gdImageColorAllocate(im3, 255, 255, 255); // white background + gdImagePaletteCopy (im3, im); // Make sure the palette is identical + gdImageRectangle(im3, 0, 0, 15, 20, black); // Draw something + // Allow animation compression with transparent pixels + gdImageColorTransparent (im3, trans); + // Add the third frame, compressing against the second one + gdImageGifAnimAdd(im3, out, 0, 0, 0, 100, 1, im2); + gdImageGifAnimEnd(out); // End marker, same as putc(';', out); + fclose(out); // Close file + + // Destroy images + gdImageDestroy(im); + gdImageDestroy(im2); + gdImageDestroy(im3); + } + + (end code) */ BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, |