1
/* tilp - a linking program for TI graphing calculators
2
* Copyright (C) 1999-2002 Romain Lievin
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#ifndef __IMAGE_FORMAT__
20
#define __IMAGE_FORMAT__
37
The image structure contains several pointers, only of them is allocated
38
at a given time (except for bitmap)
39
If the pointer has been freed, it contains NULL.
41
Note: the bitmap is never freed unless delete_image is called.
45
uint8_t *rgbmap; // a raw buffer (rrggbb for instance)
46
uint8_t *bitmap; // the image (1 bit per pixel)
47
uint8_t *bytemap; // the image (1 uint8_t per pixel -> colormap entry)
48
char **pixmap; // the image in XPM format
49
uint8_t *colormap; // the colormap (up to 256 colors)
50
int depth; // the number of colors
51
int width; // width (# of columns) of image
52
int height; // height (# of rows) of image
53
int inverted; // invert or not the the pixel color
54
int encoding; // (0 = B&W, 1 = 256 colors/greyscales)
56
typedef struct Image_ Image;
58
// Constant for the 'type' field
59
#define IMG_BW_TYPE 0 // Black & White
60
#define IMG_COL_TYPE 1 // 256 colors max
62
/*****************************/
63
/* PCX file format functions */
64
/*****************************/
66
int write_pcx_format(FILE *file, Image *img);
67
int read_pcx_format (FILE *file, Image *img);
70
/*****************************/
71
/* JPG file format functions */
72
/*****************************/
74
int write_jpg_format(FILE *file, Image *img);
75
int read_jpg_format (FILE *file, Image *img);
77
int write_jpg_true_colors(FILE *file, Image *img);
79
/*****************************/
80
/* XPM file format functions */
81
/*****************************/
83
int write_xpm_format(FILE *file, Image *img);
84
int read_xpm_format (FILE *file, Image *img);
86
/*****************************/
87
/* BMP file format functions */
88
/*****************************/
90
int write_bmp_format(FILE *file, Image *img);
91
int read_bmp_format (FILE *file, Image *img);
93
/*****************************/
94
/* ICO file format functions */
95
/*****************************/
97
int write_ico_format(FILE *file, Image *img);
98
int read_ico_format (FILE *file, Image *img);
101
/*********************/
102
/* Utility functions */
103
/*********************/
105
int convert_pixmap_to_bytemap(Image *img);
106
int convert_bytemap_to_pixmap(Image *img);
107
int convert_bitmap_to_pixmap(Image *img);
108
int convert_bitmap_to_bytemap(Image *img);
109
int convert_bytemap_to_bitmap(Image *img);
111
int compute_colormap(Image *img);
112
int convert_bytemap_to_rgbmap(Image *img);
113
int convert_rgbmap_to_bytemap(Image *img);
114
int convert_rgbmap_to_bytemap(Image *img);
116
void delete_bitmap(Image *img);
117
void delete_bytemap(Image *img);
118
void delete_colormap(Image *img);
119
void delete_pixmap(Image *img);
120
void delete_rgbmap(Image *img);
121
void delete_image(Image *img);
123
void clear_image(Image *img);
125
void alloc_bitmap(Image *img);
126
void alloc_colormap(Image *img);
127
void alloc_bytemap(Image *img);
128
void alloc_rgbmap(Image *img);
130
void invert_bitmap(Image *img);
131
void invert_bytemap(Image *img);
133
int blurry_bitmap(Image *img);