Blob Blame History Raw
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>GIF Output</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.52 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="GIF_Output"></a>GIF Output</h1><div class=CBody><p>Write GIF images.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#GIF_Output" >GIF Output</a></td><td class=SDescription>Write GIF images.</td></tr><tr class="SGroup"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#gdImageGifPtr" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">gdImageGifPtr</a></td><td class=SDescription>Identical to <a href="#gdImageGif" class=LFunction id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">gdImageGif</a> except that it returns a pointer to a memory area with the GIF data. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#gdImageGif" id=link3 onMouseOver="ShowTip(event, 'tt2', 'link3')" onMouseOut="HideTip('tt2')">gdImageGif</a></td><td class=SDescription><a href="#gdImageGif" class=LFunction id=link4 onMouseOver="ShowTip(event, 'tt2', 'link4')" onMouseOut="HideTip('tt2')">gdImageGif</a> outputs the specified image to the specified file in GIF format. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#gdImageGifCtx" id=link5 onMouseOver="ShowTip(event, 'tt3', 'link5')" onMouseOut="HideTip('tt3')">gdImageGifCtx</a></td><td class=SDescription>Writes a GIF image via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link6 onMouseOver="ShowTip(event, 'tt4', 'link6')" onMouseOut="HideTip('tt4')">gdIOCtx</a>. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#gdImageGifAnimBeginPtr" id=link7 onMouseOver="ShowTip(event, 'tt5', 'link7')" onMouseOut="HideTip('tt5')">gdImageGifAnimBeginPtr</a></td><td class=SDescription>Like <a href="#gdImageGifAnimBegin" class=LFunction id=link8 onMouseOver="ShowTip(event, 'tt6', 'link8')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a> except that it outputs to a memory buffer. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#gdImageGifAnimBegin" id=link9 onMouseOver="ShowTip(event, 'tt6', 'link9')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a></td><td class=SDescription>This function must be called as the first function when creating a GIF animation. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#gdImageGifAnimBeginCtx" id=link10 onMouseOver="ShowTip(event, 'tt7', 'link10')" onMouseOut="HideTip('tt7')">gdImageGifAnimBeginCtx</a></td><td class=SDescription>Like <a href="#gdImageGifAnimBegin" class=LFunction id=link11 onMouseOver="ShowTip(event, 'tt6', 'link11')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a> except that it outputs to <a href="gd_io-h.html#gdIOCtx" class=LType id=link12 onMouseOver="ShowTip(event, 'tt4', 'link12')" onMouseOut="HideTip('tt4')">gdIOCtx</a>. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#gdImageGifAnimAddPtr" id=link13 onMouseOver="ShowTip(event, 'tt8', 'link13')" onMouseOut="HideTip('tt8')">gdImageGifAnimAddPtr</a></td><td class=SDescription>Like <a href="#gdImageGifAnimAdd" class=LFunction id=link14 onMouseOver="ShowTip(event, 'tt9', 'link14')" onMouseOut="HideTip('tt9')">gdImageGifAnimAdd</a> (which contains more information) except that it stores the data to write into memory and returns a pointer to it.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#gdImageGifAnimAdd" id=link15 onMouseOver="ShowTip(event, 'tt9', 'link15')" onMouseOut="HideTip('tt9')">gdImageGifAnimAdd</a></td><td class=SDescription>This function writes GIF animation frames to GIF animation, which was initialized with <a href="#gdImageGifAnimBegin" class=LFunction id=link16 onMouseOver="ShowTip(event, 'tt6', 'link16')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a>. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#gdImageGifAnimAddCtx" id=link17 onMouseOver="ShowTip(event, 'tt10', 'link17')" onMouseOut="HideTip('tt10')">gdImageGifAnimAddCtx</a></td><td class=SDescription>Adds an animation frame via a &lt;gdIOCtxPtr&gt;. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#gdImageGifAnimEnd" id=link18 onMouseOver="ShowTip(event, 'tt11', 'link18')" onMouseOut="HideTip('tt11')">gdImageGifAnimEnd</a></td><td class=SDescription>Terminates the GIF file properly.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#gdImageGifAnimEndPtr" id=link19 onMouseOver="ShowTip(event, 'tt12', 'link19')" onMouseOut="HideTip('tt12')">gdImageGifAnimEndPtr</a></td><td class=SDescription>Like <a href="#gdImageGifAnimEnd" class=LFunction id=link20 onMouseOver="ShowTip(event, 'tt11', 'link20')" onMouseOut="HideTip('tt11')">gdImageGifAnimEnd</a> (which contains more information) except that it stores the data to write into memory and returns a pointer to it.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#gdImageGifAnimEndCtx" id=link21 onMouseOver="ShowTip(event, 'tt13', 'link21')" onMouseOut="HideTip('tt13')">gdImageGifAnimEndCtx</a></td><td class=SDescription>Like <a href="#gdImageGifAnimEnd" class=LFunction id=link22 onMouseOver="ShowTip(event, 'tt11', 'link22')" onMouseOut="HideTip('tt11')">gdImageGifAnimEnd</a>, but writes its data via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link23 onMouseOver="ShowTip(event, 'tt4', 'link23')" onMouseOut="HideTip('tt4')">gdIOCtx</a>.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifPtr"></a>gdImageGifPtr</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifPtr(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Identical to <a href="#gdImageGif" class=LFunction id=link24 onMouseOver="ShowTip(event, 'tt2', 'link24')" onMouseOut="HideTip('tt2')">gdImageGif</a> except that it returns a pointer to a memory area with the GIF data.&nbsp; This memory must be freed by the caller when it is no longer needed.</p><p>The caller <b>must</b> invoke <a href="gdhelpers-c.html#gdFree" class=LFunction id=link25 onMouseOver="ShowTip(event, 'tt14', 'link25')" onMouseOut="HideTip('tt14')">gdFree</a>, not <u>free()</u>.&nbsp;  This is because it is not guaranteed that libgd will use the same implementation of malloc, free, etc. as your proggram.</p><p>The &lsquo;size&rsquo; parameter receives the total size of the block of memory.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The image to write</td></tr><tr><td class=CDLEntry>size</td><td class=CDLDescription>Output: the size of the resulting image.</td></tr></table><h4 class=CHeading>Returns</h4><p>A pointer to the GIF data or NULL if an error occurred.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGif"></a>gdImageGif</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGif(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p><a href="#gdImageGif" class=LFunction id=link26 onMouseOver="ShowTip(event, 'tt2', 'link26')" onMouseOut="HideTip('tt2')">gdImageGif</a> outputs the specified image to the specified file in GIF format.&nbsp; The file must be open for binary writing.&nbsp; (Under MSDOS and all versions of Windows, it is important to use &ldquo;wb&rdquo; as opposed to simply &ldquo;w&rdquo; as the mode when opening the file; under Unix there is no penalty for doing so).&nbsp; <a href="#gdImageGif" class=LFunction id=link27 onMouseOver="ShowTip(event, 'tt2', 'link27')" onMouseOut="HideTip('tt2')">gdImageGif</a> does not close the file; your code must do so.</p><p>GIF does not support true color; GIF images can contain a maximum of 256 colors.&nbsp; If the image to be written is a truecolor image, such as those created with gdImageCreateTrueColor or loaded from a JPEG or a truecolor PNG image file, a palette-based temporary image will automatically be created internally using the <a href="gd_topal-c.html#gdImageCreatePaletteFromTrueColor" class=LFunction id=link28 onMouseOver="ShowTip(event, 'tt15', 'link28')" onMouseOut="HideTip('tt15')">gdImageCreatePaletteFromTrueColor</a> function.&nbsp; The original image pixels are not modified.&nbsp; This conversion produces high quality palettes but does require some CPU time.&nbsp; If you are regularly converting truecolor to palette in this way, you should consider creating your image as a palette-based image in the first place.</p><h4 class=CHeading>Variants</h4><p><a href="#gdImageGifCtx" class=LFunction id=link29 onMouseOver="ShowTip(event, 'tt3', 'link29')" onMouseOut="HideTip('tt3')">gdImageGifCtx</a> outputs the image via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link30 onMouseOver="ShowTip(event, 'tt4', 'link30')" onMouseOut="HideTip('tt4')">gdIOCtx</a> struct.</p><p><a href="#gdImageGifPtr" class=LFunction id=link31 onMouseOver="ShowTip(event, 'tt1', 'link31')" onMouseOut="HideTip('tt1')">gdImageGifPtr</a> stores the image in a large array of bytes.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The image to write</td></tr><tr><td class=CDLEntry>outFile</td><td class=CDLDescription>The FILE pointer to write the image to.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing</p><h4 class=CHeading>Example</h4><blockquote><pre>gdImagePtr im;
int black, white;
FILE *out;
// Create the image
im = gdImageCreate(100, 100);
// Allocate background
white = gdImageColorAllocate(im, 255, 255, 255);
// Allocate drawing color
black = gdImageColorAllocate(im, 0, 0, 0);
// Draw rectangle
gdImageRectangle(im, 0, 0, 99, 99, black);
// Open output file in binary mode
out = fopen(&quot;rect.gif&quot;, &quot;wb&quot;);
// Write GIF
gdImageGif(im, out);
// Close file
fclose(out);
// Destroy image
gdImageDestroy(im);</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifCtx"></a>gdImageGifCtx</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifCtx(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdIOCtxPtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>out</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes a GIF image via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link32 onMouseOver="ShowTip(event, 'tt4', 'link32')" onMouseOut="HideTip('tt4')">gdIOCtx</a>.&nbsp;  See <a href="#gdImageGif" class=LFunction id=link33 onMouseOver="ShowTip(event, 'tt2', 'link33')" onMouseOut="HideTip('tt2')">gdImageGif</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The image to write</td></tr><tr><td class=CDLEntry>out</td><td class=CDLDescription>The <a href="gd_io-h.html#gdIOCtx" class=LType id=link34 onMouseOver="ShowTip(event, 'tt4', 'link34')" onMouseOut="HideTip('tt4')">gdIOCtx</a> struct used to do the writing.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimBeginPtr"></a>gdImageGifAnimBeginPtr</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifAnimBeginPtr(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>GlobalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Loops</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Like <a href="#gdImageGifAnimBegin" class=LFunction id=link35 onMouseOver="ShowTip(event, 'tt6', 'link35')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a> except that it outputs to a memory buffer.&nbsp;  See <a href="#gdImageGifAnimBegin" class=LFunction id=link36 onMouseOver="ShowTip(event, 'tt6', 'link36')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a>.</p><p>The returned memory must be freed by the caller when it is no longer needed.&nbsp; **The caller must invoke &lt;gdFree&gt;(), not free()**, unless the caller is absolutely certain that the same implementations of malloc, free, etc. are used both at library build time and at application build time (but don&rsquo;t; it could always change).</p><p>The &lsquo;size&rsquo; parameter receives the total size of the block of memory.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The reference image</td></tr><tr><td class=CDLEntry>size</td><td class=CDLDescription>Output: the size in bytes of the result.</td></tr><tr><td class=CDLEntry>GlobalCM</td><td class=CDLDescription>Global colormap flag: 1 -&gt; yes, 0 -&gt; no, -1 -&gt; do default</td></tr><tr><td class=CDLEntry>Loops</td><td class=CDLDescription>Loop count; 0 -&gt; infinite, -1 means no loop</td></tr></table><h4 class=CHeading>Returns</h4><p>A pointer to the resulting data (the contents of the start of the GIF) or NULL if an error occurred.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimBegin"></a>gdImageGifAnimBegin</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimBegin(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>GlobalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Loops</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>This function must be called as the first function when creating a GIF animation.&nbsp; It writes the correct GIF file headers to selected file output, and prepares for frames to be added for the animation.&nbsp; The image argument is not used to produce an image frame to the file, it is only used to establish the GIF animation frame size, interlacing options and the color palette.&nbsp; <a href="#gdImageGifAnimAdd" class=LFunction id=link37 onMouseOver="ShowTip(event, 'tt9', 'link37')" onMouseOut="HideTip('tt9')">gdImageGifAnimAdd</a> is used to add the first and subsequent frames to the animation, and the animation must be terminated by writing a semicolon character (;) to it or by using gdImageGifAnimEnd to do that.</p><p>The GlobalCM flag indicates if a global color map (or palette) is used in the GIF89A header.&nbsp; A nonzero value specifies that a global color map should be used to reduce the size of the animation.&nbsp; Of course, if the color maps of individual frames differ greatly, a global color map may not be a good idea.&nbsp; GlobalCM=1 means write global color map, GlobalCM=0 means do not, and GlobalCM=-1 means to do the default, which currently is to use a global color map.</p><p>If Loops is 0 or greater, the Netscape 2.0 extension for animation loop count is written.&nbsp; 0 means infinite loop count.&nbsp; -1 means that the extension is not added which results in no looping.&nbsp; -1 is the default.</p><h4 class=CHeading>Variants</h4><p><a href="#gdImageGifAnimBeginCtx" class=LFunction id=link38 onMouseOver="ShowTip(event, 'tt7', 'link38')" onMouseOut="HideTip('tt7')">gdImageGifAnimBeginCtx</a> outputs the image via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link39 onMouseOver="ShowTip(event, 'tt4', 'link39')" onMouseOut="HideTip('tt4')">gdIOCtx</a> struct.</p><p><a href="#gdImageGifAnimBeginPtr" class=LFunction id=link40 onMouseOver="ShowTip(event, 'tt5', 'link40')" onMouseOut="HideTip('tt5')">gdImageGifAnimBeginPtr</a> stores the image in a large array of bytes.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The reference image</td></tr><tr><td class=CDLEntry>outfile</td><td class=CDLDescription>The output FILE*.</td></tr><tr><td class=CDLEntry>GlobalCM</td><td class=CDLDescription>Global colormap flag: 1 -&gt; yes, 0 -&gt; no, -1 -&gt; do default</td></tr><tr><td class=CDLEntry>Loops</td><td class=CDLDescription>Loop count; 0 -&gt; infinite, -1 means no loop</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p><h4 class=CHeading>Example</h4><p>See <a href="#gdImageGifAnimBegin" class=LFunction id=link41 onMouseOver="ShowTip(event, 'tt6', 'link41')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a>.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimBeginCtx"></a>gdImageGifAnimBeginCtx</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimBeginCtx(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdIOCtxPtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>out,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>GlobalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>Loops</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Like <a href="#gdImageGifAnimBegin" class=LFunction id=link42 onMouseOver="ShowTip(event, 'tt6', 'link42')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a> except that it outputs to <a href="gd_io-h.html#gdIOCtx" class=LType id=link43 onMouseOver="ShowTip(event, 'tt4', 'link43')" onMouseOut="HideTip('tt4')">gdIOCtx</a>.&nbsp; See <a href="#gdImageGifAnimBegin" class=LFunction id=link44 onMouseOver="ShowTip(event, 'tt6', 'link44')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The reference image</td></tr><tr><td class=CDLEntry>out</td><td class=CDLDescription>Pointer to the output <a href="gd_io-h.html#gdIOCtx" class=LType id=link45 onMouseOver="ShowTip(event, 'tt4', 'link45')" onMouseOut="HideTip('tt4')">gdIOCtx</a>.</td></tr><tr><td class=CDLEntry>GlobalCM</td><td class=CDLDescription>Global colormap flag: 1 -&gt; yes, 0 -&gt; no, -1 -&gt; do default</td></tr><tr><td class=CDLEntry>Loops</td><td class=CDLDescription>Loop count; 0 -&gt; infinite, -1 means no loop</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimAddPtr"></a>gdImageGifAnimAddPtr</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifAnimAddPtr(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LocalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LeftOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>TopOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Delay,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Disposal,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>previm</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Like <a href="#gdImageGifAnimAdd" class=LFunction id=link46 onMouseOver="ShowTip(event, 'tt9', 'link46')" onMouseOut="HideTip('tt9')">gdImageGifAnimAdd</a> (which contains more information) except that it stores the data to write into memory and returns a pointer to it.</p><p>This memory must be freed by the caller when it is no longer needed.&nbsp; **The caller must invoke &lt;gdFree&gt;(), not free(),** unless the caller is absolutely certain that the same implementations of malloc, free, etc. are used both at library build time and at application build time (but don&rsquo;t; it could always change).</p><p>The &lsquo;size&rsquo; parameter receives the total size of the block of memory.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The image to add.</td></tr><tr><td class=CDLEntry>size</td><td class=CDLDescription>Output: the size of the resulting buffer.</td></tr><tr><td class=CDLEntry>LocalCM</td><td class=CDLDescription>Flag.&nbsp;  If 1, use a local color map for this frame.</td></tr><tr><td class=CDLEntry>LeftOfs</td><td class=CDLDescription>Left offset of image in frame.</td></tr><tr><td class=CDLEntry>TopOfs</td><td class=CDLDescription>Top offset of image in frame.</td></tr><tr><td class=CDLEntry>Delay</td><td class=CDLDescription>Delay before next frame (in 1/100 seconds)</td></tr><tr><td class=CDLEntry>Disposal</td><td class=CDLDescription>MODE: How to treat this frame when the next one loads.</td></tr><tr><td class=CDLEntry>previm</td><td class=CDLDescription>NULL or a pointer to the previous image written.</td></tr></table><h4 class=CHeading>Returns</h4><p>Pointer to the resulting data or NULL if an error occurred.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimAdd"></a>gdImageGifAnimAdd</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimAdd(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LocalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LeftOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>TopOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Delay,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Disposal,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>previm</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>This function writes GIF animation frames to GIF animation, which was initialized with <a href="#gdImageGifAnimBegin" class=LFunction id=link47 onMouseOver="ShowTip(event, 'tt6', 'link47')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a>.&nbsp; With <u>LeftOfs</u> and <u>TopOfs</u> you can place this frame in different offset than (0,0) inside the image screen as defined in <a href="#gdImageGifAnimBegin" class=LFunction id=link48 onMouseOver="ShowTip(event, 'tt6', 'link48')" onMouseOut="HideTip('tt6')">gdImageGifAnimBegin</a>.&nbsp; Delay between the previous frame and this frame is in 1/100s units.&nbsp; <u>Disposal</u> is usually <a href="gd-h.html#gdDisposalNone" class=LConstant id=link49 onMouseOver="ShowTip(event, 'tt16', 'link49')" onMouseOut="HideTip('tt16')">gdDisposalNone</a>, meaning that the pixels changed by this frame should remain on the display when the next frame begins to render, but can also be <a href="gd-h.html#gdDisposalUnknown" class=LConstant id=link50 onMouseOver="ShowTip(event, 'tt17', 'link50')" onMouseOut="HideTip('tt17')">gdDisposalUnknown</a> (not recommended), <a href="gd-h.html#gdDisposalRestoreBackground" class=LConstant id=link51 onMouseOver="ShowTip(event, 'tt18', 'link51')" onMouseOut="HideTip('tt18')">gdDisposalRestoreBackground</a> (restores the first allocated color of the global palette), or <a href="gd-h.html#gdDisposalRestorePrevious" class=LConstant id=link52 onMouseOver="ShowTip(event, 'tt19', 'link52')" onMouseOut="HideTip('tt19')">gdDisposalRestorePrevious</a> (restores the appearance of the affected area before the frame was rendered).&nbsp; Only <a href="gd-h.html#gdDisposalNone" class=LConstant id=link53 onMouseOver="ShowTip(event, 'tt16', 'link53')" onMouseOut="HideTip('tt16')">gdDisposalNone</a> is a sensible choice for the first frame.&nbsp; If <u>previm</u> is passed, the built-in GIF optimizer will always use <a href="gd-h.html#gdDisposalNone" class=LConstant id=link54 onMouseOver="ShowTip(event, 'tt16', 'link54')" onMouseOut="HideTip('tt16')">gdDisposalNone</a> regardless of the Disposal parameter.</p><p>Setting the <u>LocalCM</u> flag to 1 adds a local palette for this image to the animation.&nbsp; Otherwise the global palette is assumed and the user must make sure the palettes match.&nbsp; Use <a href="gd-c.html#gdImagePaletteCopy" class=LFunction id=link55 onMouseOver="ShowTip(event, 'tt20', 'link55')" onMouseOut="HideTip('tt20')">gdImagePaletteCopy</a> to do that.</p><p>Automatic optimization is activated by giving the previous image as a parameter.&nbsp; This function then compares the images and only writes the changed pixels to the new frame in animation.&nbsp; The <u>Disposal</u> parameter for optimized animations must be set to 1, also for the first frame.&nbsp; <u>LeftOfs</u> and <u>TopOfs</u> parameters are ignored for optimized frames.&nbsp; To achieve good optimization, it is usually best to use a single global color map.&nbsp; To allow <a href="#gdImageGifAnimAdd" class=LFunction id=link56 onMouseOver="ShowTip(event, 'tt9', 'link56')" onMouseOut="HideTip('tt9')">gdImageGifAnimAdd</a> to compress unchanged pixels via the use of a transparent color, the image must include a transparent color.</p><h4 class=CHeading>Variants</h4><p><a href="#gdImageGifAnimAddCtx" class=LFunction id=link57 onMouseOver="ShowTip(event, 'tt10', 'link57')" onMouseOut="HideTip('tt10')">gdImageGifAnimAddCtx</a> outputs its data via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link58 onMouseOver="ShowTip(event, 'tt4', 'link58')" onMouseOut="HideTip('tt4')">gdIOCtx</a> struct.</p><p><a href="#gdImageGifAnimAddPtr" class=LFunction id=link59 onMouseOver="ShowTip(event, 'tt8', 'link59')" onMouseOut="HideTip('tt8')">gdImageGifAnimAddPtr</a> outputs its data to a memory buffer which it returns.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The image to add.</td></tr><tr><td class=CDLEntry>outfile</td><td class=CDLDescription>The output FILE* being written.</td></tr><tr><td class=CDLEntry>LocalCM</td><td class=CDLDescription>Flag.&nbsp;  If 1, use a local color map for this frame.</td></tr><tr><td class=CDLEntry>LeftOfs</td><td class=CDLDescription>Left offset of image in frame.</td></tr><tr><td class=CDLEntry>TopOfs</td><td class=CDLDescription>Top offset of image in frame.</td></tr><tr><td class=CDLEntry>Delay</td><td class=CDLDescription>Delay before next frame (in 1/100 seconds)</td></tr><tr><td class=CDLEntry>Disposal</td><td class=CDLDescription>MODE: How to treat this frame when the next one loads.</td></tr><tr><td class=CDLEntry>previm</td><td class=CDLDescription>NULL or a pointer to the previous image written.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p><h4 class=CHeading>Example</h4><blockquote><pre class="prettyprint">{
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(&quot;anim.gif&quot;, &quot;wb&quot;);// 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);
}</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimAddCtx"></a>gdImageGifAnimAddCtx</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimAddCtx(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdIOCtxPtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>out,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>LocalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>LeftOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>TopOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>Delay,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>Disposal,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>previm</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds an animation frame via a &lt;gdIOCtxPtr&gt;.&nbsp;  See gdImageGifAnimAdd&gt;.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>im</td><td class=CDLDescription>The image to add.</td></tr><tr><td class=CDLEntry>out</td><td class=CDLDescription>The output &lt;gdIOCtxPtr&gt;.</td></tr><tr><td class=CDLEntry>LocalCM</td><td class=CDLDescription>Flag.&nbsp;  If 1, use a local color map for this frame.</td></tr><tr><td class=CDLEntry>LeftOfs</td><td class=CDLDescription>Left offset of image in frame.</td></tr><tr><td class=CDLEntry>TopOfs</td><td class=CDLDescription>Top offset of image in frame.</td></tr><tr><td class=CDLEntry>Delay</td><td class=CDLDescription>Delay before next frame (in 1/100 seconds)</td></tr><tr><td class=CDLEntry>Disposal</td><td class=CDLDescription>MODE: How to treat this frame when the next one loads.</td></tr><tr><td class=CDLEntry>previm</td><td class=CDLDescription>NULL or a pointer to the previous image written.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimEnd"></a>gdImageGifAnimEnd</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimEnd(</td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Terminates the GIF file properly.</p><p>(Previous versions of this function&rsquo;s documentation suggested just manually writing a semicolon (&lsquo;;&rsquo;) instead since that is all this function does.&nbsp;  While that has no longer changed, we now suggest that you do not do this and instead always call <a href="#gdImageGifAnimEnd" class=LFunction id=link60 onMouseOver="ShowTip(event, 'tt11', 'link60')" onMouseOut="HideTip('tt11')">gdImageGifAnimEnd</a> (or equivalent) since later versions could possibly do more or different things.)</p><h4 class=CHeading>Variants</h4><p><a href="#gdImageGifAnimEndCtx" class=LFunction id=link61 onMouseOver="ShowTip(event, 'tt13', 'link61')" onMouseOut="HideTip('tt13')">gdImageGifAnimEndCtx</a> outputs its data via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link62 onMouseOver="ShowTip(event, 'tt4', 'link62')" onMouseOut="HideTip('tt4')">gdIOCtx</a> struct.</p><p><a href="#gdImageGifAnimEndPtr" class=LFunction id=link63 onMouseOver="ShowTip(event, 'tt12', 'link63')" onMouseOut="HideTip('tt12')">gdImageGifAnimEndPtr</a> outputs its data to a memory buffer which it returns.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>outfile</td><td class=CDLDescription>the destination FILE*.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimEndPtr"></a>gdImageGifAnimEndPtr</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifAnimEndPtr(</td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Like <a href="#gdImageGifAnimEnd" class=LFunction id=link64 onMouseOver="ShowTip(event, 'tt11', 'link64')" onMouseOut="HideTip('tt11')">gdImageGifAnimEnd</a> (which contains more information) except that it stores the data to write into memory and returns a pointer to it.</p><p>This memory must be freed by the caller when it is no longer needed.&nbsp; **The caller must invoke &lt;gdFree&gt;(), not free(),** unless the caller is absolutely certain that the same implementations of malloc, free, etc. are used both at library build time and at application build time (but don&rsquo;t; it could always change).</p><p>The &lsquo;size&rsquo; parameter receives the total size of the block of memory.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>size</td><td class=CDLDescription>Output: the size of the resulting buffer.</td></tr></table><h4 class=CHeading>Returns</h4><p>Pointer to the resulting data or NULL if an error occurred.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gdImageGifAnimEndCtx"></a>gdImageGifAnimEndCtx</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimEndCtx(</td><td class="PType  prettyprint " nowrap>gdIOCtx&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>out</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Like <a href="#gdImageGifAnimEnd" class=LFunction id=link65 onMouseOver="ShowTip(event, 'tt11', 'link65')" onMouseOut="HideTip('tt11')">gdImageGifAnimEnd</a>, but writes its data via a <a href="gd_io-h.html#gdIOCtx" class=LType id=link66 onMouseOver="ShowTip(event, 'tt4', 'link66')" onMouseOut="HideTip('tt4')">gdIOCtx</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>out</td><td class=CDLDescription>the destination <a href="gd_io-h.html#gdIOCtx" class=LType id=link67 onMouseOver="ShowTip(event, 'tt4', 'link67')" onMouseOut="HideTip('tt4')">gdIOCtx</a>.</td></tr></table><h4 class=CHeading>Returns</h4><p>Nothing.</p></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile><a href="preamble-txt.html">About LibGD 2.<wbr>3.0-dev</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Image Formats</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="gd_bmp-c.html">BMP IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_gd-c.html">GD IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_gd2-c.html">GD2 IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_gif_in-c.html">GIF Input</a></div></div><div class=MEntry><div class=MFile id=MSelected>GIF Output</div></div><div class=MEntry><div class=MFile><a href="gd_jpeg-c.html">JPEG IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_png-c.html">PNG IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_tga-c.html">TGA Input</a></div></div><div class=MEntry><div class=MFile><a href="gd_tiff-c.html">TIFF IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_wbmp-c.html">WBMP IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_webp-c.html">WebP IO</a></div></div><div class=MEntry><div class=MFile><a href="gd_xbm-c.html">XBM IO</a></div></div><div class=MEntry><div class=MFile><a href="gdxpm-c.html">XPM Input</a></div></div></div></div></div><div class=MEntry><div class=MFile><a href="gd_topal-c.html">Color Quantization</a></div></div><div class=MEntry><div class=MFile><a href="gd_crop-c.html">Cropping</a></div></div><div class=MEntry><div class=MFile><a href="gdft-c.html">FreeType font rendering</a></div></div><div class=MEntry><div class=MFile><a href="gd-c.html">gd.c</a></div></div><div class=MEntry><div class=MFile><a href="gd-h.html">gd.h</a></div></div><div class=MEntry><div class=MFile><a href="gd_filename-c.html">gd_filename.c</a></div></div><div class=MEntry><div class=MFile><a href="gd_interpolation-c.html">gd_interpolation.c</a></div></div><div class=MEntry><div class=MFile><a href="gd_io-h.html">gd_io.h</a></div></div><div class=MEntry><div class=MFile><a href="gd_io_dp-c.html">gd_io_dp.c</a></div></div><div class=MEntry><div class=MFile><a href="gd_ss-c.html">gd_ss.c</a></div></div><div class=MEntry><div class=MFile><a href="gd_version-c.html">gd_version.c</a></div></div><div class=MEntry><div class=MFile><a href="gd_color_map-c.html">gdColorMapLookup</a></div></div><div class=MEntry><div class=MFile><a href="gdhelpers-c.html">gdFree</a></div></div><div class=MEntry><div class=MFile><a href="gdfx-c.html">gdfx.c</a></div></div><div class=MEntry><div class=MFile><a href="gd_color_match-c.html">gdImageColorMatch</a></div></div><div class=MEntry><div class=MFile><a href="gd_nnquant-c.html">gdImageNeuQuant</a></div></div><div class=MEntry><div class=MFile><a href="gd_io_file-c.html">gdNewFileCtx</a></div></div><div class=MEntry><div class=MFile><a href="gd_io_ss-c.html">gdNewSSCtx</a></div></div><div class=MEntry><div class=MFile><a href="gd_filter-c.html">Image Filters</a></div></div><div class=MEntry><div class=MFile><a href="license-txt.html">License</a></div></div><div class=MEntry><div class=MFile><a href="gd_matrix-c.html">Matrix</a></div></div><div class=MEntry><div class=MFile><a href="gd_transform-c.html">Transformations</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Built-in Fonts</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="gdfontg-c.html">Giant Font</a></div></div><div class=MEntry><div class=MFile><a href="gdfontl-c.html">Large Font</a></div></div><div class=MEntry><div class=MFile><a href="gdfontmb-c.html">Medium Bold Font</a></div></div><div class=MEntry><div class=MFile><a href="gdfonts-c.html">Small Font</a></div></div><div class=MEntry><div class=MFile><a href="gdfontt-c.html">Tiny Font</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../index/Constants.html">Constants</a></div></div><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Macros.html">Macros</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Types.html">Types</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Constants">Constants</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Macros">Macros</option><option value="Types">Types</option></select></div><script language=JavaScript><!--
HideAllBut([1], 4);// --></script></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifPtr(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Identical to gdImageGif except that it returns a pointer to a memory area with the GIF data. </div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGif(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>gdImageGif outputs the specified image to the specified file in GIF format. </div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifCtx(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdIOCtxPtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>out</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Writes a GIF image via a gdIOCtx. </div></div><div class=CToolTip id="tt4"><div class=CType>gdIOCtx structures hold function pointers for doing image IO.</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifAnimBeginPtr(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>GlobalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Loops</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Like gdImageGifAnimBegin except that it outputs to a memory buffer. </div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimBegin(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>GlobalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Loops</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>This function must be called as the first function when creating a GIF animation. </div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimBeginCtx(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdIOCtxPtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>out,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>GlobalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>Loops</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Like gdImageGifAnimBegin except that it outputs to gdIOCtx. </div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifAnimAddPtr(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LocalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LeftOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>TopOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Delay,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Disposal,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>previm</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Like gdImageGifAnimAdd (which contains more information) except that it stores the data to write into memory and returns a pointer to it.</div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimAdd(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LocalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>LeftOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>TopOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Delay,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>Disposal,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap></td><td class="PParameter  prettyprint " nowrap>previm</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>This function writes GIF animation frames to GIF animation, which was initialized with gdImageGifAnimBegin. </div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimAddCtx(</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdIOCtxPtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>out,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>LocalCM,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>LeftOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>TopOfs,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>Delay,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>Disposal,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>previm</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Adds an animation frame via a gdIOCtxPtr. </div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimEnd(</td><td class="PType  prettyprint " nowrap>FILE&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>outFile</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Terminates the GIF file properly.</div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void * gdImageGifAnimEndPtr(</td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>size</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Like gdImageGifAnimEnd (which contains more information) except that it stores the data to write into memory and returns a pointer to it.</div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImageGifAnimEndCtx(</td><td class="PType  prettyprint " nowrap>gdIOCtx&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>out</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Like gdImageGifAnimEnd, but writes its data via a gdIOCtx.</div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdFree (</td><td class="PType  prettyprint " nowrap>void&nbsp;</td><td class="PParameterPrefix  prettyprint " nowrap>*</td><td class="PParameter  prettyprint " nowrap>ptr</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Frees memory that has been allocated by libgd functions.</div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>gdImagePtr gdImageCreatePaletteFromTrueColor (</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>im,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>dither,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>int&nbsp;</td><td class="PParameter  prettyprint " nowrap>colorsWanted</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Creates a new palette image from a truecolor image</div></div><div class=CToolTip id="tt16"><div class=CConstant>Preserve previous frame</div></div><div class=CToolTip id="tt17"><div class=CConstant>Not recommended</div></div><div class=CToolTip id="tt18"><div class=CConstant>First allocated color of palette</div></div><div class=CToolTip id="tt19"><div class=CConstant>Restore to before start of frame</div></div><div class=CToolTip id="tt20"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>void gdImagePaletteCopy (</td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>to,</td></tr><tr><td></td><td class="PType  prettyprint " nowrap>gdImagePtr&nbsp;</td><td class="PParameter  prettyprint " nowrap>from</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote></div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>