File: flimage_int.h

package info (click to toggle)
libforms 1.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,192 kB
  • sloc: ansic: 98,419; sh: 11,156; makefile: 959
file content (246 lines) | stat: -rw-r--r-- 7,158 bytes parent folder | download | duplicates (5)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*
 *  This file is part of the XForms library package.
 *
 *  XForms is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation; either version 2.1, or
 *  (at your option) any later version.
 *
 *  XForms is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with XForms.  If not, see <http://www.gnu.org/licenses/>.
 */


/*
 *  This file is part of the XForms library package.
 *  Copyright (c) 1996-2001  T.C. Zhao
 *  All rights reserved.
 *
 *  Headers used internally by image support
 */

#ifndef FLIMAGE_INT_H_
#define FLIMAGE_INT_H_

#include "ulib.h"

#define fli_safe_free( p )   do {                   \
                                 if ( p )           \
                                 {                  \
                                     fl_free( p );  \
                                     p = NULL;      \
                                 }                  \
                             } while( 0 )

typedef struct flimageIO {
    const char          * formal_name;
    const char          * short_name;
    const char          * signature;
    const char          * extension;
    int                   type;
    FLIMAGE_Identify      identify;
    FLIMAGE_Description   read_description;
    FLIMAGE_Read_Pixels   read_pixels;
    FLIMAGE_Write_Image   write_image;
    int annotation;
} FLIMAGE_IO;

typedef struct {
    int    w,
           h;
    int    type;
    void * pixels;
} FLIMAGE_BUFFER;

/* Subimage for convolve etc */

typedef struct {
    int    w,
           h;
    void * mat[ 3 ];
    int    comp;                   /* number of components */
} SubImage;

SubImage * flimage_get_subimage( FL_IMAGE * im,
                                 int make );


#define FL_IsGray( t )        ( t == FL_IMAGE_GRAY || t == FL_IMAGE_GRAY16 )
#define FL_IsCI( t )          ( t == FL_IMAGE_CI   || t == FL_IMAGE_MONO )
#define FLIMAGE_MAXLUT        ( 1 << FL_LUTBITS )

extern FLIMAGE_IO *flimage_io;

typedef int ( * FLIMAGE_QUANTIZE_RGB )( unsigned char **,
                                        unsigned char **,
                                        unsigned char **,
                                        int,
                                        int,
                                        int,
                                        unsigned short **,
                                        int *,
                                        int *,
                                        int *,
                                        int *,
                                        FL_IMAGE * );

typedef int ( * FLIMAGE_QUANTIZE_PACKED )( unsigned int   **,
                                           int,
                                           int,
                                           int,
                                           unsigned short **,
                                           int *,
                                           int *,
                                           int *,
                                           int *,
                                           FL_IMAGE * );

extern FLIMAGE_QUANTIZE_RGB flimage_quantize_rgb;

extern FLIMAGE_QUANTIZE_PACKED flimage_quantize_packed;

void flimage_replace_image( FL_IMAGE *,
                            int,
                            int,
                            void *,
                            void *,
                            void * );

int flimage_transform( FL_IMAGE *,
                       int,
                       int,
                       float m[ ][ 2 ],
                       float *shift,
                       unsigned int,
                       int subp );

int flimage_getmem( FL_IMAGE * );

void flimage_freemem( FL_IMAGE * );

void flimage_add_comments( FL_IMAGE *,
                           const char *,
                           int );

int j2pass_quantize_rgb( unsigned char **,
                         unsigned char **,
                         unsigned char **,
                         int,
                         int,
                         int,
                         unsigned short **,
                         int *,
                         int *,
                         int *,
                         int *,
                            FL_IMAGE * );

int j2pass_quantize_packed( unsigned int **,
                            int,
                            int,
                            int,
                            unsigned short **,
                            int *,
                            int *,
                            int *,
                            int *,
                            FL_IMAGE * );

/* These numbers can be anything, but should be less than < 128 and may not
   equal 0 */

enum {
    FL_GET_MATRIX = 100,
    FL_MAKE_MATRIX
};

void flimage_enable_gzip( void );

void flimage_invalidate_pixels( FL_IMAGE * );

int flimage_get_closest_color_from_map( FL_IMAGE *,
                                        unsigned int );

int flimage_replace_pixel( FL_IMAGE *,
                           unsigned int,
                           unsigned int );

void flimage_free_gray( FL_IMAGE * );

void flimage_free_ci( FL_IMAGE * );

void flimage_free_rgb( FL_IMAGE * );

void pack_bits( unsigned char *,
                unsigned short *,
                int );

void unpack_bits( unsigned short *,
                  unsigned char *,
                  int );

void flimage_error( FL_IMAGE *,
                    const char *,
                    ... );

void flimage_enable_genesis( void );

int fl_spline_int_interpolate( const int *,
                               const int *,
                               int,
                               int,
                               int * );

unsigned int fl_value_to_bits( unsigned int val );

int flimage_get_linearlut( FL_IMAGE * );

void flimage_free_linearlut( FL_IMAGE * );

FLIMAGE_IO *flimage_find_imageIO( const char * );

void flimage_display_markers( FL_IMAGE * );

unsigned long flimage_color_to_pixel( FL_IMAGE *,
                                      int,
                                      int,
                                      int,
                                      int * );

int flimage_write_annotation( FL_IMAGE * );

int flimage_read_annotation( FL_IMAGE * );

int flimage_swapbuffer( FL_IMAGE * );

FL_IMAGE *flimage_dup_( FL_IMAGE *,
                        int );

int flimage_to_ximage( FL_IMAGE *,
                       FL_WINDOW,
                       XWindowAttributes * );

#if ! defined( SEEK_SET )
#define SEEK_SET 0
#endif
#if ! defined( SEEK_CUR )
#define SEEK_CUR 1
#endif
#if ! defined( SEEK_END )
#define SEEK_END 2
#endif

#endif      /* FLIMAGE_INT_H */


/*
 * Local variables:
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */