~ubuntu-branches/ubuntu/breezy/tiemu/breezy

« back to all changes in this revision

Viewing changes to src/hid/img/img_fmt.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2005-06-02 16:50:15 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050602165015-59ab24414tl2wzol
Tags: 1.99+svn1460-1
* New snapshot.
* debian/control:
  + Updated build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  tilp - a linking program for TI graphing calculators
2
 
 *  Copyright (C) 1999-2002  Romain Lievin
3
 
 *
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.
8
 
 *
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.
13
 
 *
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.
17
 
 */
18
 
 
19
 
#ifndef __IMAGE_FORMAT__
20
 
#define __IMAGE_FORMAT__
21
 
 
22
 
#ifdef HAVE_CONFIG_H
23
 
# include <config.h>
24
 
#endif
25
 
 
26
 
#include <stdio.h>
27
 
#include <stdint.h>
28
 
 
29
 
#define MAXCHARS 256
30
 
 
31
 
 
32
 
/*******************/
33
 
/* Image structure */
34
 
/*******************/
35
 
 
36
 
/*
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.
40
 
  
41
 
  Note: the bitmap is never freed unless delete_image is called.
42
 
*/
43
 
struct Image_
44
 
{
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)
55
 
};
56
 
typedef struct Image_ Image;
57
 
 
58
 
// Constant for the 'type' field
59
 
#define IMG_BW_TYPE  0 // Black & White
60
 
#define IMG_COL_TYPE 1 // 256 colors max
61
 
 
62
 
/*****************************/
63
 
/* PCX file format functions */
64
 
/*****************************/
65
 
 
66
 
int write_pcx_format(FILE *file, Image *img);
67
 
int read_pcx_format (FILE *file, Image *img);
68
 
 
69
 
 
70
 
/*****************************/
71
 
/* JPG file format functions */
72
 
/*****************************/
73
 
 
74
 
int write_jpg_format(FILE *file, Image *img);
75
 
int read_jpg_format (FILE *file, Image *img);
76
 
 
77
 
int write_jpg_true_colors(FILE *file, Image *img);
78
 
 
79
 
/*****************************/
80
 
/* XPM file format functions */
81
 
/*****************************/
82
 
 
83
 
int write_xpm_format(FILE *file, Image *img);
84
 
int read_xpm_format (FILE *file, Image *img);
85
 
 
86
 
/*****************************/
87
 
/* BMP file format functions */
88
 
/*****************************/
89
 
 
90
 
int write_bmp_format(FILE *file, Image *img);
91
 
int read_bmp_format (FILE *file, Image *img);
92
 
 
93
 
/*****************************/
94
 
/* ICO file format functions */
95
 
/*****************************/
96
 
 
97
 
int write_ico_format(FILE *file, Image *img);
98
 
int read_ico_format (FILE *file, Image *img);
99
 
 
100
 
 
101
 
/*********************/
102
 
/* Utility functions */
103
 
/*********************/
104
 
 
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);
110
 
 
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);
115
 
 
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);
122
 
 
123
 
void clear_image(Image *img);
124
 
 
125
 
void alloc_bitmap(Image *img);
126
 
void alloc_colormap(Image *img);
127
 
void alloc_bytemap(Image *img);
128
 
void alloc_rgbmap(Image *img);
129
 
 
130
 
void invert_bitmap(Image *img);
131
 
void invert_bytemap(Image *img);
132
 
 
133
 
int blurry_bitmap(Image *img);
134
 
 
135
 
#endif
136