Leptonica  1.83.1
Image processing and image analysis suite
pix_internal.h
Go to the documentation of this file.
1 /*====================================================================*
2  - Copyright (C) 2001 Leptonica. All rights reserved.
3  -
4  - Redistribution and use in source and binary forms, with or without
5  - modification, are permitted provided that the following conditions
6  - are met:
7  - 1. Redistributions of source code must retain the above copyright
8  - notice, this list of conditions and the following disclaimer.
9  - 2. Redistributions in binary form must reproduce the above
10  - copyright notice, this list of conditions and the following
11  - disclaimer in the documentation and/or other materials
12  - provided with the distribution.
13  -
14  - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15  - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16  - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17  - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18  - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *====================================================================*/
26 
27 #ifndef LEPTONICA_PIX_INTERNAL_H
28 #define LEPTONICA_PIX_INTERNAL_H
29 
173 /*-------------------------------------------------------------------------*
174  * Basic Pix *
175  *-------------------------------------------------------------------------*/
176  /* The 'special' field is by default 0, but it can hold integers
177  * that direct non-default actions, e.g., in png and jpeg I/O. */
178 
180 struct Pix
181 {
182  l_uint32 w;
183  l_uint32 h;
184  l_uint32 d;
185  l_uint32 spp;
186  l_uint32 wpl;
187  l_atomic refcount;
188  l_int32 xres;
190  l_int32 yres;
192  l_int32 informat;
193  l_int32 special;
194  char *text;
196  l_uint32 *data;
197 };
198 
201 {
202  void *array;
203  l_int32 depth;
204  l_int32 nalloc;
205  l_int32 n;
206 };
207 
208 
213 struct RGBA_Quad
214 {
215  l_uint8 blue;
216  l_uint8 green;
217  l_uint8 red;
218  l_uint8 alpha;
219 };
220 
221 
222 /*-------------------------------------------------------------------------*
223  * Array of pix *
224  *-------------------------------------------------------------------------*/
225  /* Serialization for primary data structures */
226 #define PIXAA_VERSION_NUMBER 2
227 #define PIXA_VERSION_NUMBER 2
228 #define BOXA_VERSION_NUMBER 2
229 #define BOXAA_VERSION_NUMBER 3
232 struct Pixa
233 {
234  l_int32 n;
235  l_int32 nalloc;
236  l_atomic refcount;
237  struct Pix **pix;
238  struct Boxa *boxa;
239 };
240 
242 struct Pixaa
243 {
244  l_int32 n;
245  l_int32 nalloc;
246  struct Pixa **pixa;
247  struct Boxa *boxa;
248 };
249 
250 
251 /*-------------------------------------------------------------------------*
252  * Basic rectangle and rectangle arrays *
253  *-------------------------------------------------------------------------*/
255 struct Box
256 {
257  l_int32 x;
258  l_int32 y;
259  l_int32 w;
260  l_int32 h;
261  l_atomic refcount;
262 };
263 
265 struct Boxa
266 {
267  l_int32 n;
268  l_int32 nalloc;
269  l_atomic refcount;
270  struct Box **box;
271 };
272 
274 struct Boxaa
275 {
276  l_int32 n;
277  l_int32 nalloc;
278  struct Boxa **boxa;
279 };
280 
281 
282 /*-------------------------------------------------------------------------*
283  * Array of points *
284  *-------------------------------------------------------------------------*/
285 #define PTA_VERSION_NUMBER 1
288 struct Pta
289 {
290  l_int32 n;
291  l_int32 nalloc;
292  l_atomic refcount;
293  l_float32 *x, *y;
294 };
295 
296 
297 /*-------------------------------------------------------------------------*
298  * Array of Pta *
299  *-------------------------------------------------------------------------*/
301 struct Ptaa
302 {
303  l_int32 n;
304  l_int32 nalloc;
305  struct Pta **pta;
306 };
307 
308 
309 /*-------------------------------------------------------------------------*
310  * Pix accumulator container *
311  *-------------------------------------------------------------------------*/
313 struct Pixacc
314 {
315  l_int32 w;
316  l_int32 h;
317  l_int32 offset;
319  struct Pix *pix;
320 };
321 
322 
323 /*-------------------------------------------------------------------------*
324  * Pix tiling *
325  *-------------------------------------------------------------------------*/
327 struct PixTiling
328 {
329  struct Pix *pix;
330  l_int32 nx;
331  l_int32 ny;
332  l_int32 w;
333  l_int32 h;
334  l_int32 xoverlap;
335  l_int32 yoverlap;
336  l_int32 strip;
337 };
338 
339 
340 /*-------------------------------------------------------------------------*
341  * FPix: pix with float array *
342  *-------------------------------------------------------------------------*/
343 #define FPIX_VERSION_NUMBER 2
346 struct FPix
347 {
348  l_int32 w;
349  l_int32 h;
350  l_int32 wpl;
351  l_atomic refcount;
352  l_int32 xres;
354  l_int32 yres;
356  l_float32 *data;
357 };
358 
360 struct FPixa
361 {
362  l_int32 n;
363  l_int32 nalloc;
364  l_atomic refcount;
365  struct FPix **fpix;
366 };
367 
368 
369 /*-------------------------------------------------------------------------*
370  * DPix: pix with double array *
371  *-------------------------------------------------------------------------*/
372 #define DPIX_VERSION_NUMBER 2
375 struct DPix
376 {
377  l_int32 w;
378  l_int32 h;
379  l_int32 wpl;
380  l_atomic refcount;
381  l_int32 xres;
383  l_int32 yres;
385  l_float64 *data;
386 };
387 
388 
389 /*-------------------------------------------------------------------------*
390  * PixComp: compressed pix *
391  *-------------------------------------------------------------------------*/
393 struct PixComp
394 {
395  l_int32 w;
396  l_int32 h;
397  l_int32 d;
398  l_int32 xres;
400  l_int32 yres;
402  l_int32 comptype;
404  char *text;
405  l_int32 cmapflag;
406  l_uint8 *data;
407  size_t size;
408 };
409 
410 
411 /*-------------------------------------------------------------------------*
412  * PixaComp: array of compressed pix *
413  *-------------------------------------------------------------------------*/
414 #define PIXACOMP_VERSION_NUMBER 2
417 struct PixaComp
418 {
419  l_int32 n;
420  l_int32 nalloc;
421  l_int32 offset;
422  struct PixComp **pixc;
423  struct Boxa *boxa;
424 };
425 
426 #endif /* LEPTONICA_PIX_INTERNAL_H */
l_int32 y
Definition: pix_internal.h:258
l_int32 x
Definition: pix_internal.h:257
l_int32 w
Definition: pix_internal.h:259
l_int32 h
Definition: pix_internal.h:260
l_atomic refcount
Definition: pix_internal.h:261
l_int32 nalloc
Definition: pix_internal.h:268
l_int32 n
Definition: pix_internal.h:267
l_atomic refcount
Definition: pix_internal.h:269
struct Box ** box
Definition: pix_internal.h:270
l_int32 nalloc
Definition: pix_internal.h:277
struct Boxa ** boxa
Definition: pix_internal.h:278
l_int32 n
Definition: pix_internal.h:276
l_int32 h
Definition: pix_internal.h:378
l_int32 yres
Definition: pix_internal.h:383
l_float64 * data
Definition: pix_internal.h:385
l_int32 w
Definition: pix_internal.h:377
l_int32 xres
Definition: pix_internal.h:381
l_atomic refcount
Definition: pix_internal.h:380
l_int32 wpl
Definition: pix_internal.h:379
l_int32 w
Definition: pix_internal.h:348
l_atomic refcount
Definition: pix_internal.h:351
l_int32 wpl
Definition: pix_internal.h:350
l_int32 xres
Definition: pix_internal.h:352
l_int32 h
Definition: pix_internal.h:349
l_float32 * data
Definition: pix_internal.h:356
l_int32 yres
Definition: pix_internal.h:354
l_int32 nalloc
Definition: pix_internal.h:363
struct FPix ** fpix
Definition: pix_internal.h:365
l_atomic refcount
Definition: pix_internal.h:364
l_int32 n
Definition: pix_internal.h:362
void * array
Definition: pix_internal.h:202
l_int32 depth
Definition: pix_internal.h:203
l_int32 nalloc
Definition: pix_internal.h:204
l_int32 w
Definition: pix_internal.h:395
size_t size
Definition: pix_internal.h:407
l_uint8 * data
Definition: pix_internal.h:406
l_int32 cmapflag
Definition: pix_internal.h:405
l_int32 xres
Definition: pix_internal.h:398
char * text
Definition: pix_internal.h:404
l_int32 yres
Definition: pix_internal.h:400
l_int32 d
Definition: pix_internal.h:397
l_int32 h
Definition: pix_internal.h:396
l_int32 comptype
Definition: pix_internal.h:402
l_int32 yoverlap
Definition: pix_internal.h:335
l_int32 nx
Definition: pix_internal.h:330
l_int32 w
Definition: pix_internal.h:332
l_int32 xoverlap
Definition: pix_internal.h:334
struct Pix * pix
Definition: pix_internal.h:329
l_int32 h
Definition: pix_internal.h:333
l_int32 strip
Definition: pix_internal.h:336
l_int32 ny
Definition: pix_internal.h:331
l_uint32 d
Definition: pix_internal.h:184
l_uint32 * data
Definition: pix_internal.h:196
l_uint32 spp
Definition: pix_internal.h:185
struct PixColormap * colormap
Definition: pix_internal.h:195
l_atomic refcount
Definition: pix_internal.h:187
l_uint32 wpl
Definition: pix_internal.h:186
l_uint32 w
Definition: pix_internal.h:182
l_int32 xres
Definition: pix_internal.h:188
l_uint32 h
Definition: pix_internal.h:183
l_int32 yres
Definition: pix_internal.h:190
char * text
Definition: pix_internal.h:194
l_int32 special
Definition: pix_internal.h:193
l_int32 informat
Definition: pix_internal.h:192
l_int32 offset
Definition: pix_internal.h:421
l_int32 nalloc
Definition: pix_internal.h:420
l_int32 n
Definition: pix_internal.h:419
struct PixComp ** pixc
Definition: pix_internal.h:422
struct Boxa * boxa
Definition: pix_internal.h:423
struct Pix ** pix
Definition: pix_internal.h:237
l_atomic refcount
Definition: pix_internal.h:236
struct Boxa * boxa
Definition: pix_internal.h:238
l_int32 nalloc
Definition: pix_internal.h:235
l_int32 n
Definition: pix_internal.h:234
l_int32 nalloc
Definition: pix_internal.h:245
l_int32 n
Definition: pix_internal.h:244
struct Pixa ** pixa
Definition: pix_internal.h:246
struct Boxa * boxa
Definition: pix_internal.h:247
l_int32 offset
Definition: pix_internal.h:317
l_int32 h
Definition: pix_internal.h:316
l_int32 w
Definition: pix_internal.h:315
struct Pix * pix
Definition: pix_internal.h:319
l_atomic refcount
Definition: pix_internal.h:292
l_int32 nalloc
Definition: pix_internal.h:291
l_int32 n
Definition: pix_internal.h:290
l_float32 * y
Definition: pix_internal.h:293
struct Pta ** pta
Definition: pix_internal.h:305
l_int32 n
Definition: pix_internal.h:303
l_int32 nalloc
Definition: pix_internal.h:304
l_uint8 alpha
Definition: pix_internal.h:218
l_uint8 green
Definition: pix_internal.h:216
l_uint8 blue
Definition: pix_internal.h:215
l_uint8 red
Definition: pix_internal.h:217