Back to index

plt-scheme  4.2.1
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 /* Exported functions: */
00016 extern void gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
00017 extern gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource);
00018 
00019 /* Use this for commenting out debug-print statements. */
00020 /* Just use the first '#define' to allow all the prints... */
00021 /*#define GD_SS_DBG(s) (s) */
00022 #define GD_SS_DBG(s)
00023 
00024 #ifdef HAVE_LIBPNG
00025 void
00026 gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
00027 {
00028   gdIOCtx *out = gdNewSSCtx (NULL, outSink);
00029   gdImagePngCtx (im, out);
00030   out->gd_free (out);
00031 }
00032 
00033 gdImagePtr
00034 gdImageCreateFromPngSource (gdSourcePtr inSource)
00035 {
00036   gdIOCtx *in = gdNewSSCtx (inSource, NULL);
00037   gdImagePtr im;
00038 
00039   im = gdImageCreateFromPngCtx (in);
00040 
00041   in->gd_free (in);
00042 
00043   return im;
00044 }
00045 #else /* no HAVE_LIBPNG */
00046 void
00047 gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
00048 {
00049   fprintf (stderr, "PNG support is not available\n");
00050 }
00051 
00052 gdImagePtr
00053 gdImageCreateFromPngSource (gdSourcePtr inSource)
00054 {
00055   fprintf (stderr, "PNG support is not available\n");
00056   return NULL;
00057 }
00058 #endif /* HAVE_LIBPNG */