KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
pcx.h
Go to the documentation of this file.
1 /* KallistiOS ##version##
2 
3  kos/pcx.h
4  Copyright (C) 2000-2001 Dan Potter
5 
6 */
7 
8 #ifndef __KOS_PCX_H
9 #define __KOS_PCX_H
10 
11 /** \file kos/pcx.h
12  \brief Small PCX Loader.
13 
14  This module provides a few functions used for loading PCX files. These
15  funcions were mainly for use on the GBA port of KallistiOS (which has been
16  removed from the tree), although they can be used pretty much anywhere.
17  That said, libpcx is generally more useful than these functions for use on
18  the Dreamcast.
19 
20  \author Dan Potter
21 */
22 
23 #include <sys/cdefs.h>
24 __BEGIN_DECLS
25 
26 #include <arch/types.h>
27 
28 /* These first two versions are mainly for use with the GBA, and they are
29  defined in the "pcx_small" file. They can be used on any architecture of
30  course. */
31 
32 /** \brief Load a PCX file into a buffer as flat 15-bit BGR data.
33 
34  This function loads the specified PCX file into the buffer provided,
35  decoding the image to 15-bit BGR pixels. The width and height of the buffer
36  should match that of the image itself.
37 
38  \param fn The file to load.
39  \param w_out Buffer to return the width of the image in.
40  \param h_out Buffer to return the height of the image in.
41  \param pic_out Buffer to store image data in.
42  \return 0 on succes, < 0 on failure.
43 */
44 int pcx_load_flat(const char *fn, int *w_out, int *h_out, void *pic_out);
45 
46 /** \brief Load a PCX file into a buffer as paletted data.
47 
48  This function is similar to the pcx_load_flat() function, but instead of
49  decoding the image into a flat buffer, it decodes the image into a paletted
50  format. The image itself will be 8-bit paletted pixels, and the palette is
51  in a 15-bit BGR format. The width and height of the buffer should match that
52  of the image itself.
53 
54  \param fn The file to load.
55  \param w_out Buffer to return the width of the image in.
56  \param h_out Buffer to return the height of the image in.
57  \param pic_out Buffer to store image data in. This should be width *
58  height bytes in size.
59  \param pal_out Buffer to store the palette data in. This should be
60  allocated to hold 256 uint16_t values.
61  \return 0 on succes, < 0 on failure.
62 */
63 int pcx_load_palette(const char *fn, int *w_out, int *h_out, void *pic_out,
64  void *pal_out);
65 
66 __END_DECLS
67 
68 #endif /* __KOS_PCX_H */
69 
Common integer types.
int pcx_load_palette(const char *fn, int *w_out, int *h_out, void *pic_out, void *pal_out)
Load a PCX file into a buffer as paletted data.
int pcx_load_flat(const char *fn, int *w_out, int *h_out, void *pic_out)
Load a PCX file into a buffer as flat 15-bit BGR data.