diff options
Diffstat (limited to 'Build/source/libs/gd/gd_ss.c')
-rw-r--r-- | Build/source/libs/gd/gd_ss.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Build/source/libs/gd/gd_ss.c b/Build/source/libs/gd/gd_ss.c new file mode 100644 index 00000000000..18fc50d2b90 --- /dev/null +++ b/Build/source/libs/gd/gd_ss.c @@ -0,0 +1,50 @@ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> +#include "gd.h" + +#define TRUE 1 +#define FALSE 0 + +/* Use this for commenting out debug-print statements. */ +/* Just use the first '#define' to allow all the prints... */ +/*#define GD_SS_DBG(s) (s) */ +#define GD_SS_DBG(s) + +#ifdef HAVE_LIBPNG +BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink) +{ + gdIOCtx *out = gdNewSSCtx (NULL, outSink); + gdImagePngCtx (im, out); + out->gd_free (out); +} + +BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr inSource) +{ + gdIOCtx *in = gdNewSSCtx (inSource, NULL); + gdImagePtr im; + + im = gdImageCreateFromPngCtx (in); + + in->gd_free (in); + + return im; +} +#else /* no HAVE_LIBPNG */ +BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink) +{ + fprintf (stderr, "PNG support is not available\n"); +} + +BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr inSource) +{ + fprintf (stderr, "PNG support is not available\n"); + return NULL; +} +#endif /* HAVE_LIBPNG */ |