src/lib/vGif.c 1.5
1.5 2009/08/19 22:28:36 angie
Added option to mgSaveToGif and its call stack, to use GIF's Graphic Control Extension to make memgfx's background color (0) transparent. Also corrected terminology for PNG in .h files: useAlpha -> useTransparency.
Index: src/lib/vGif.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/vGif.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -B -U 4 -r1.4 -r1.5
--- src/lib/vGif.c 6 May 2003 07:33:44 -0000 1.4
+++ src/lib/vGif.c 19 Aug 2009 22:28:36 -0000 1.5
@@ -13,8 +13,9 @@
/* Something that handles a gif. */
{
struct memGfx mg; /* Memory form. This needs to be first field. */
char *fileName; /* Gif file name. */
+ boolean useTransparency;
};
void memGifClose(struct memGif **pG)
/* Write out and close and free. */
@@ -22,16 +23,16 @@
struct memGif *g = *pG;
if (g != NULL)
{
struct memGfx *mg = (struct memGfx *)g;
- mgSaveGif(mg, g->fileName);
+ mgSaveGif(mg, g->fileName, g->useTransparency);
freez(&g->fileName);
mgFree(&mg);
*pG = NULL;
}
}
-struct vGfx *vgOpenGif(int width, int height, char *fileName)
+struct vGfx *vgOpenGif(int width, int height, char *fileName, boolean useTransparency)
/* Open up something that will someday be a PostScript file. */
{
struct memGif *gif;
struct memGfx *mg;
@@ -45,8 +46,9 @@
/* Get our mg + fileName structure. We're forcing
* inheritence from mg essentially. */
AllocVar(gif);
gif->fileName = cloneString(fileName);
+gif->useTransparency = useTransparency;
/* Fill in the mg part of this structure with normal memGfx. */
mg = mgNew(width, height);
mgClearPixels(mg);