summaryrefslogtreecommitdiff
path: root/ext/gd/libgd/gd_ss.c
blob: 200442ba0fe97034d83439998e6339671bcc34cf (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
#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)

void
gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
{
  gdIOCtx *out = gdNewSSCtx (NULL, outSink);
  gdImagePngCtx (im, out);
  out->free (out);
}

gdImagePtr
gdImageCreateFromPngSource (gdSourcePtr inSource)
{
  gdIOCtx *in = gdNewSSCtx (inSource, NULL);
  gdImagePtr im;

  im = gdImageCreateFromPngCtx (in);

  in->free (in);

  return im;
}