summaryrefslogtreecommitdiff
path: root/tools/gslite/gslt_image.h
blob: bdafb9a45afc818b906fb76664e6e785fe4370e3 (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
/* Copyright (C) 2006 artofcode LLC.
   All Rights Reserved.

   This software is provided AS-IS with no warranty, either express or
   implied.

   This software is distributed under license and may not be copied, modified
   or distributed except as expressly authorized under the terms of that
   license.  Refer to licensing information at http://www.artifex.com/
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
*/

/* $Id: gslt_image.h 2713 2007-01-02 22:22:14Z henrys $*/
/* gslt image loading interface */

#ifndef gslt_image_INCLUDED
#  define gslt_image_INCLUDED

/* primary image object type */
typedef struct gslt_image_s gslt_image_t;

/* colorspace enumeration for image data */
typedef enum {
    GSLT_GRAY,
    GSLT_GRAY_A,
    GSLT_RGB,
    GSLT_RGB_A,
    GSLT_CMYK, 
    GSLT_CMYK_A,
    GSLT_UNDEFINED  /* sentinel for the last defined colorspace */
} gslt_image_colorspace; 

/* definition of the image object structure */
struct gslt_image_s {
    int width;	/* image width */
    int height; /* image height */
    int stride; /* byte offset between image data rows */
    int components; /* number of components (channels) per pixel */
    int bits;	/* bits per component */
    int xres;	/* horizontal image resolution in pixels per meter */
    int yres;	/* vertical image resolution in pixels per meter */
    byte *samples; /* image data buffer */
    gslt_image_colorspace colorspace; /* image pixel component mapping */
};

/* decode an image from a memory buffer */
gslt_image_t *gslt_image_decode(gs_memory_t *mem, byte *buf, int len);

/* free an image object when it is no longer needed */
void gslt_image_free(gs_memory_t *mem, gslt_image_t *image);


/* decode a memory buffer as a particular image format */
gslt_image_t *gslt_image_decode_jpeg(gs_memory_t *mem, byte *buf, int len);
gslt_image_t *gslt_image_decode_png( gs_memory_t *mem, byte *buf, int len);
gslt_image_t *gslt_image_decode_tiff(gs_memory_t *mem, byte *buf, int len);

#endif /* gslt_image_INCLUDED */