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 0 : {
22 0 : gdIOCtx *out = gdNewSSCtx(NULL, outSink);
23 0 : gdImagePngCtx(im, out);
24 0 : out->gd_free(out);
25 0 : }
26 :
27 : gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
28 0 : {
29 0 : gdIOCtx *in = gdNewSSCtx(inSource, NULL);
30 : gdImagePtr im;
31 :
32 0 : im = gdImageCreateFromPngCtx(in);
33 :
34 0 : in->gd_free(in);
35 :
36 0 : 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 :
|