php-src/ext/gd/libgd/gd_ss.c

50 lines
1.1 KiB
C
Raw Normal View History

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#define TRUE 1
#define FALSE 0
/* Exported functions: */
extern void gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
extern gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource);
/* 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
2003-03-14 16:56:38 +00:00
void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
{
2003-03-14 16:56:38 +00:00
gdIOCtx *out = gdNewSSCtx(NULL, outSink);
gdImagePngCtx(im, out);
out->gd_free(out);
}
2003-03-14 16:56:38 +00:00
gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
{
2003-03-14 16:56:38 +00:00
gdIOCtx *in = gdNewSSCtx(inSource, NULL);
gdImagePtr im;
2003-03-14 16:56:38 +00:00
im = gdImageCreateFromPngCtx(in);
2003-03-14 16:56:38 +00:00
in->gd_free(in);
2003-03-14 16:56:38 +00:00
return im;
}
#else /* no HAVE_LIBPNG */
2003-03-14 16:56:38 +00:00
void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
{
2005-08-18 12:54:32 +00:00
php_gd_error("PNG support is not available");
}
2003-03-14 16:56:38 +00:00
gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
{
2005-08-18 12:54:32 +00:00
php_gd_error("PNG support is not available");
2003-03-14 16:56:38 +00:00
return NULL;
}
#endif /* HAVE_LIBPNG */