summaryrefslogtreecommitdiff
path: root/src/gd_ss.c
blob: 248699e370b9265758eb725487d76b0d08bc98cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#include "gd_errors.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
/*
	Function: gdImagePngToSink
*/
BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
{
	gdIOCtx *out = gdNewSSCtx (NULL, outSink);
	gdImagePngCtx (im, out);
	out->gd_free (out);
}

/*
  Function: gdImageCreateFromPngSource

  See <gdImageCreateFromPng> for documentation.  This is obsolete; use
  <gdImageCreateFromPngCtx> instead.
 */
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)
{
	(void)im;
	(void)outSink;
	gd_error("PNG support is not available\n");
}

BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr inSource)
{
	(void)inSource;
	gd_error("PNG support is not available\n");
	return NULL;
}
#endif /* HAVE_LIBPNG */