src/inc/memgfx.h 1.25

1.25 2009/08/05 23:34:31 angie
Added conditional use (USE_PNG) of external library libpng (http://libpng.org/pub/png/, sourceforge) to write memgfx images in the PNG format instead of GIF. Currently used (conditionally!) only for hgTracks' main image. This is to support Tim's enhancements for horizontal scrolling of the browser track image. Image file size also appears smaller than GIF but should try more test cases.
Index: src/inc/memgfx.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/inc/memgfx.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -b -B -U 4 -r1.24 -r1.25
--- src/inc/memgfx.h	19 Jun 2009 19:14:42 -0000	1.24
+++ src/inc/memgfx.h	5 Aug 2009 23:34:31 -0000	1.25
@@ -3,9 +3,9 @@
  * for personal, academic, and non-profit purposes.  Commercial use          *
  * permitted only by explicit agreement with Jim Kent (jim_kent@pacbell.net) *
  *****************************************************************************/
 /* Memgfx - stuff to do graphics in memory buffers.
- * Typically will just write these out as .gif files.
+ * Typically will just write these out as .gif or .png files.
  * This stuff is byte-a-pixel for simplicity.
  * It can do 256 colors.
  */
 #ifndef MEMGFX_H
@@ -150,8 +150,20 @@
  * This is the same that mgSaveGif creates at
  * least.  This version of gif was always
  * color mapped. */
 
+void mgSavePng(struct memGfx *mg, char *filename, boolean useAlpha);
+/* Save memory bitmap to filename as a PNG.
+ * If useAlpha, then the first color in memgfx's colormap/palette is
+ * assumed to be the image background color, and pixels of that color
+ * are made transparent. */
+
+boolean mgSaveToPng(FILE *png_file, struct memGfx *mg, boolean useAlpha);
+/* Save PNG to an already open file.
+ * If useAlpha, then the first color in memgfx's colormap/palette is
+ * assumed to be the image background color, and pixels of that color
+ * are made transparent. */
+
 typedef void (*TextBlit)(int bitWidth, int bitHeight, int bitX, int bitY,
 	unsigned char *bitData, int bitDataRowBytes, 
 	struct memGfx *dest, int destX, int destY, 
 	Color color, Color backgroundColor);