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.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.c')
-rw-r--r-- | src/gd.c | 43 |
1 files changed, 27 insertions, 16 deletions
@@ -162,11 +162,14 @@ BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y); A pointer to the new image or NULL if an error occurred. Example: + (start code) - > gdImagePtr im; - > im = gdImageCreate(64, 64); - > // ... Use the image ... - > gdImageDestroy(im); + gdImagePtr im; + im = gdImageCreate(64, 64); + // ... Use the image ... + gdImageDestroy(im); + + (end code) See Also: @@ -263,11 +266,14 @@ BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy) A pointer to the new image or NULL if an error occurred. Example: + (start code) + + gdImagePtr im; + im = gdImageCreateTrueColor(64, 64); + // ... Use the image ... + gdImageDestroy(im); - > gdImagePtr im; - > im = gdImageCreateTrueColor(64, 64); - > // ... Use the image ... - > gdImageDestroy(im); + (end code) See Also: @@ -362,12 +368,15 @@ BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy) Nothing. Example: + (start code) + + gdImagePtr im; + im = gdImageCreate(10, 10); + // ... Use the image ... + // Now destroy it + gdImageDestroy(im); - > gdImagePtr im; - > im = gdImageCreate(10, 10); - > // ... Use the image ... - > // Now destroy it - > gdImageDestroy(im); + (end code) */ @@ -673,9 +682,11 @@ BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, Function: gdImageColorResolve gdImageColorResolve is an alternative for the code fragment - | if ((color=gdImageColorExact(im,R,G,B)) < 0) - | if ((color=gdImageColorAllocate(im,R,G,B)) < 0) - | color=gdImageColorClosest(im,R,G,B); + (start code) + if ((color=gdImageColorExact(im,R,G,B)) < 0) + if ((color=gdImageColorAllocate(im,R,G,B)) < 0) + color=gdImageColorClosest(im,R,G,B); + (end code) in a single function. Its advantage is that it is guaranteed to return a color index in one search over the color table. */ |