Annotation of embedaddon/php/ext/gd/libgd/gd_ss.c, revision 1.1.1.1
1.1 misho 1: #include <stdio.h>
2: #include <math.h>
3: #include <string.h>
4: #include <stdlib.h>
5: #include "gd.h"
6:
7: #define TRUE 1
8: #define FALSE 0
9:
10: /* Exported functions: */
11: extern void gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
12: extern gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource);
13:
14: /* Use this for commenting out debug-print statements. */
15: /* Just use the first '#define' to allow all the prints... */
16: /*#define GD_SS_DBG(s) (s) */
17: #define GD_SS_DBG(s)
18:
19: #ifdef HAVE_LIBPNG
20: void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
21: {
22: gdIOCtx *out = gdNewSSCtx(NULL, outSink);
23: gdImagePngCtx(im, out);
24: out->gd_free(out);
25: }
26:
27: gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
28: {
29: gdIOCtx *in = gdNewSSCtx(inSource, NULL);
30: gdImagePtr im;
31:
32: im = gdImageCreateFromPngCtx(in);
33:
34: in->gd_free(in);
35:
36: return im;
37: }
38: #else /* no HAVE_LIBPNG */
39: void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
40: {
41: php_gd_error("PNG support is not available");
42: }
43: gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
44: {
45: php_gd_error("PNG support is not available");
46: return NULL;
47: }
48: #endif /* HAVE_LIBPNG */
49:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>