Back to index

tetex-bin  3.0
gd_ss.c
Go to the documentation of this file.
00001 
00002 #ifdef HAVE_CONFIG_H
00003 #include "config.h"
00004 #endif
00005 
00006 #include <stdio.h>
00007 #include <math.h>
00008 #include <string.h>
00009 #include <stdlib.h>
00010 #include "gd.h"
00011 
00012 #define TRUE 1
00013 #define FALSE 0
00014 
00015 /* Use this for commenting out debug-print statements. */
00016 /* Just use the first '#define' to allow all the prints... */
00017 /*#define GD_SS_DBG(s) (s) */
00018 #define GD_SS_DBG(s)
00019 
00020 #ifdef HAVE_LIBPNG
00021 BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
00022 {
00023   gdIOCtx *out = gdNewSSCtx (NULL, outSink);
00024   gdImagePngCtx (im, out);
00025   out->gd_free (out);
00026 }
00027 
00028 BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr inSource)
00029 {
00030   gdIOCtx *in = gdNewSSCtx (inSource, NULL);
00031   gdImagePtr im;
00032 
00033   im = gdImageCreateFromPngCtx (in);
00034 
00035   in->gd_free (in);
00036 
00037   return im;
00038 }
00039 #else /* no HAVE_LIBPNG */
00040 BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
00041 {
00042   fprintf (stderr, "PNG support is not available\n");
00043 }
00044 
00045 BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr inSource)
00046 {
00047   fprintf (stderr, "PNG support is not available\n");
00048   return NULL;
00049 }
00050 #endif /* HAVE_LIBPNG */