Back to index

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