diff options
| author | Steven Fuller <relnev@icculus.org> | 2001-07-30 05:22:12 +0000 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 02:22:36 +0200 |
| commit | eb5c2cc01dbd5756790860ad5eb2302f911d9dc7 (patch) | |
| tree | 2928560dd46bce280d95e549069a7130dcccd1c1 /src/tools/data.h | |
| parent | f097dd925866f7a25c9fa58dcf46b4fc59302cb6 (diff) | |
Tools for testing.
Diffstat (limited to 'src/tools/data.h')
| -rw-r--r-- | src/tools/data.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tools/data.h b/src/tools/data.h new file mode 100644 index 0000000..b1b9717 --- /dev/null +++ b/src/tools/data.h @@ -0,0 +1,61 @@ +#ifndef __DATA_H__ +#define __DATA_H__ + +#define PACKED __attribute__((packed)) + +typedef struct pcx_header_type +{ + char manufacturer; + char version; + char encoding; + char bits_per_pixel; + short int x, y; + short int width, height; + short int horz_res; + short int virt_res; + char ega_palette[48]; + char reserved; + char num_color_planes; + short int byte_per_line; + short int palette_type; + short int hscreen_size; + short int vscreen_size; + char padding[54]; +} PACKED pcx_header, *pcx_header_ptr; + +unsigned char *Pal_3_4(unsigned char *dat); + +unsigned char *Pixel_BGR_RGB(unsigned char *data, int length); +unsigned char *Pixel_BGRA_RGBA(unsigned char *data, int length); +unsigned char *Pixel_256_RGB(unsigned char *data, unsigned char *pal, int length); +unsigned char *Pixel_256_RGBA(unsigned char *data, unsigned char *pal, int length, int trans); + +unsigned char *LoadTGA(char *filename, int *width, int *height); + +unsigned char *LoadPCX(char *filename, unsigned char **pal, int *width, int *height); +unsigned char *LoadPCX_RGB(char *filename, int *width, int *height); +unsigned char *LoadPCX_RGBA(char *filename, int *width, int *height); +void SavePCX(unsigned char *buf, int width, int height, unsigned char *pal, char *name); + +void SavePCX256ToFile(unsigned char *buf, int width, int height, unsigned char *pal, char *name); +void SavePCXRGBToFile(unsigned char *buf, int width, int height, char *name); +/* + +todo: sgi graphic format, microsoft bmp format, rest of tga/pcx, ilbm +gif? +jpg? +png? + +function call asks for certain graphic format and data is converted if needed + +of course asking for an indexed type from a truecolor type will generate an +error + +EnumerateLoadImageTypes +EnumerateSaveImageTypes +EnumerateLoadImageTypeCaps +EnumerateSaveImageTypeCaps +DetermineImageType +*/ + +#endif |
