Leptonica  1.73
Image processing and image analysis suite
pix.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_H
28 #define LEPTONICA_PIX_H
29 
127 /*-------------------------------------------------------------------------*
128  * Basic Pix *
129  *-------------------------------------------------------------------------*/
130  /* The 'special' field is by default 0, but it can hold integers
131  * that direct non-default actions, e.g., in png and jpeg I/O. */
132 
134 struct Pix
135 {
136  l_uint32 w;
137  l_uint32 h;
138  l_uint32 d;
139  l_uint32 spp;
140  l_uint32 wpl;
141  l_uint32 refcount;
142  l_int32 xres;
144  l_int32 yres;
146  l_int32 informat;
147  l_int32 special;
148  char *text;
150  l_uint32 *data;
151 };
152 typedef struct Pix PIX;
153 
156 {
157  void *array;
158  l_int32 depth;
159  l_int32 nalloc;
160  l_int32 n;
161 };
162 typedef struct PixColormap PIXCMAP;
163 
164 
169 struct RGBA_Quad
170 {
171  l_uint8 blue;
172  l_uint8 green;
173  l_uint8 red;
174  l_uint8 alpha;
175 };
176 typedef struct RGBA_Quad RGBA_QUAD;
177 
178 
179 
180 /*-------------------------------------------------------------------------*
181  * Colors for 32 bpp *
182  *-------------------------------------------------------------------------*/
183 /* <pre>
184  * Notes:
185  * (1) These are the byte indices for colors in 32 bpp images.
186  * They are used through the GET/SET_DATA_BYTE accessors.
187  * The 4th byte, typically known as the "alpha channel" and used
188  * for blending, is used to a small extent in leptonica.
189  * (2) Do not change these values! If you redefine them, functions
190  * that have the shifts hardcoded for efficiency and conciseness
191  * (instead of using the constants below) will break. These
192  * functions are labelled with "***" next to their names at
193  * the top of the files in which they are defined.
194  * (3) The shifts to extract the red, green, blue and alpha components
195  * from a 32 bit pixel are defined here.
196  * </pre>
197  */
198 
200 enum {
201  COLOR_RED = 0,
205 };
206 
207 static const l_int32 L_RED_SHIFT =
208  8 * (sizeof(l_uint32) - 1 - COLOR_RED); /* 24 */
209 static const l_int32 L_GREEN_SHIFT =
210  8 * (sizeof(l_uint32) - 1 - COLOR_GREEN); /* 16 */
211 static const l_int32 L_BLUE_SHIFT =
212  8 * (sizeof(l_uint32) - 1 - COLOR_BLUE); /* 8 */
213 static const l_int32 L_ALPHA_SHIFT =
214  8 * (sizeof(l_uint32) - 1 - L_ALPHA_CHANNEL); /* 0 */
215 
216 
217 /*-------------------------------------------------------------------------*
218  * Colors for drawing boxes *
219  *-------------------------------------------------------------------------*/
221 enum {
228 };
229 
230 
231 /*-------------------------------------------------------------------------*
232  * Perceptual color weights *
233  *-------------------------------------------------------------------------*/
234 /* <pre>
235  * Notes:
236  * (1) These perceptual weighting factors are ad-hoc, but they do
237  * add up to 1. Unlike, for example, the weighting factors for
238  * converting RGB to luminance, or more specifically to Y in the
239  * YUV colorspace. Those numbers come from the
240  * International Telecommunications Union, via ITU-R.
241  * </pre>
242  */
243 static const l_float32 L_RED_WEIGHT = 0.3;
244 static const l_float32 L_GREEN_WEIGHT = 0.5;
245 static const l_float32 L_BLUE_WEIGHT = 0.2;
248 /*-------------------------------------------------------------------------*
249  * Flags for colormap conversion *
250  *-------------------------------------------------------------------------*/
252 enum {
258 };
259 
260 
261 /*------------------------------------------------------------------------*
262  *!
263  * <pre>
264  * The following operation bit flags have been modified from
265  * Sun's pixrect.h.
266  *
267  * The 'op' in 'rasterop' is represented by an integer
268  * composed with Boolean functions using the set of five integers
269  * given below. The integers, and the op codes resulting from
270  * boolean expressions on them, need only be in the range from 0 to 15.
271  * The function is applied on a per-pixel basis.
272  *
273  * Examples: the op code representing ORing the src and dest
274  * is computed using the bit OR, as PIX_SRC | PIX_DST; the op
275  * code representing XORing src and dest is found from
276  * PIX_SRC ^ PIX_DST; the op code representing ANDing src and dest
277  * is found from PIX_SRC & PIX_DST. Note that
278  * PIX_NOT(PIX_CLR) = PIX_SET, and v.v., as they must be.
279  *
280  * We use the following set of definitions:
281  *
282  * #define PIX_SRC 0xc
283  * #define PIX_DST 0xa
284  * #define PIX_NOT(op) (op) ^ 0xf
285  * #define PIX_CLR 0x0
286  * #define PIX_SET 0xf
287  *
288  * These definitions differ from Sun's, in that Sun left-shifted
289  * each value by 1 pixel, and used the least significant bit as a
290  * flag for the "pseudo-operation" of clipping. We don't need
291  * this bit, because it is both efficient and safe ALWAYS to clip
292  * the rectangles to the src and dest images, which is what we do.
293  * See the notes in rop.h on the general choice of these bit flags.
294  *
295  * [If for some reason you need compatibility with Sun's xview package,
296  * you can adopt the original Sun definitions to avoid redefinition conflicts:
297  *
298  * #define PIX_SRC (0xc << 1)
299  * #define PIX_DST (0xa << 1)
300  * #define PIX_NOT(op) ((op) ^ 0x1e)
301  * #define PIX_CLR (0x0 << 1)
302  * #define PIX_SET (0xf << 1)
303  * ]
304  *
305  * We have, for reference, the following 16 unique op flags:
306  *
307  * PIX_CLR 0000 0x0
308  * PIX_SET 1111 0xf
309  * PIX_SRC 1100 0xc
310  * PIX_DST 1010 0xa
311  * PIX_NOT(PIX_SRC) 0011 0x3
312  * PIX_NOT(PIX_DST) 0101 0x5
313  * PIX_SRC | PIX_DST 1110 0xe
314  * PIX_SRC & PIX_DST 1000 0x8
315  * PIX_SRC ^ PIX_DST 0110 0x6
316  * PIX_NOT(PIX_SRC) | PIX_DST 1011 0xb
317  * PIX_NOT(PIX_SRC) & PIX_DST 0010 0x2
318  * PIX_SRC | PIX_NOT(PIX_DST) 1101 0xd
319  * PIX_SRC & PIX_NOT(PIX_DST) 0100 0x4
320  * PIX_NOT(PIX_SRC | PIX_DST) 0001 0x1
321  * PIX_NOT(PIX_SRC & PIX_DST) 0111 0x7
322  * PIX_NOT(PIX_SRC ^ PIX_DST) 1001 0x9
323  *
324  * </pre>
325  *-------------------------------------------------------------------------*/
326 
327 #define PIX_SRC (0xc)
328 #define PIX_DST (0xa)
329 #define PIX_NOT(op) ((op) ^ 0x0f)
330 #define PIX_CLR (0x0)
331 #define PIX_SET (0xf)
333 #define PIX_PAINT (PIX_SRC | PIX_DST)
334 #define PIX_MASK (PIX_SRC & PIX_DST)
335 #define PIX_SUBTRACT (PIX_DST & PIX_NOT(PIX_SRC))
337 #define PIX_XOR (PIX_SRC ^ PIX_DST)
340 /*-------------------------------------------------------------------------*
341  * <pre>
342  * Important Notes:
343  *
344  * (1) The image data is stored in a single contiguous
345  * array of l_uint32, into which the pixels are packed.
346  * By "packed" we mean that there are no unused bits
347  * between pixels, except for end-of-line padding to
348  * satisfy item (2) below.
349  *
350  * (2) Every image raster line begins on a 32-bit word
351  * boundary within this array.
352  *
353  * (3) Pix image data is stored in 32-bit units, with the
354  * pixels ordered from left to right in the image being
355  * stored in order from the MSB to LSB within the word,
356  * for both big-endian and little-endian machines.
357  * This is the natural ordering for big-endian machines,
358  * as successive bytes are stored and fetched progressively
359  * to the right. However, for little-endians, when storing
360  * we re-order the bytes from this byte stream order, and
361  * reshuffle again for byte access on 32-bit entities.
362  * So if the bytes come in sequence from left to right, we
363  * store them on little-endians in byte order:
364  * 3 2 1 0 7 6 5 4 ...
365  * This MSB to LSB ordering allows left and right shift
366  * operations on 32 bit words to move the pixels properly.
367  *
368  * (4) We use 32 bit pixels for both RGB and RGBA color images.
369  * The A (alpha) byte is ignored in most leptonica functions
370  * operating on color images. Within each 4 byte pixel, the
371  * color samples are ordered from MSB to LSB, as follows:
372  *
373  * | MSB | 2nd MSB | 3rd MSB | LSB |
374  * red green blue alpha
375  * 0 1 2 3 (big-endian)
376  * 3 2 1 0 (little-endian)
377  *
378  * Because we use MSB to LSB ordering within the 32-bit word,
379  * the individual 8-bit samples can be accessed with
380  * GET_DATA_BYTE and SET_DATA_BYTE macros, using the
381  * (implicitly big-ending) ordering
382  * red: byte 0 (MSB)
383  * green: byte 1 (2nd MSB)
384  * blue: byte 2 (3rd MSB)
385  * alpha: byte 3 (LSB)
386  *
387  * The specific color assignment is made in this file,
388  * through the definitions of COLOR_RED, etc. Then the R, G
389  * B and A sample values can be retrieved using
390  * redval = GET_DATA_BYTE(&pixel, COLOR_RED);
391  * greenval = GET_DATA_BYTE(&pixel, COLOR_GREEN);
392  * blueval = GET_DATA_BYTE(&pixel, COLOR_BLUE);
393  * alphaval = GET_DATA_BYTE(&pixel, L_ALPHA_CHANNEL);
394  * and they can be set with
395  * SET_DATA_BYTE(&pixel, COLOR_RED, redval);
396  * SET_DATA_BYTE(&pixel, COLOR_GREEN, greenval);
397  * SET_DATA_BYTE(&pixel, COLOR_BLUE, blueval);
398  * SET_DATA_BYTE(&pixel, L_ALPHA_CHANNEL, alphaval);
399  *
400  * More efficiently, these components can be extracted directly
401  * by shifting and masking, explicitly using the values in
402  * L_RED_SHIFT, etc.:
403  * (pixel32 >> L_RED_SHIFT) & 0xff; (red)
404  * (pixel32 >> L_GREEN_SHIFT) & 0xff; (green)
405  * (pixel32 >> L_BLUE_SHIFT) & 0xff; (blue)
406  * (pixel32 >> L_ALPHA_SHIFT) & 0xff; (alpha)
407  * The functions extractRGBValues() and extractRGBAValues() are
408  * provided to do this. Likewise, the pixels can be set
409  * directly by shifting, using composeRGBPixel() and
410  * composeRGBAPixel().
411  *
412  * All these operations work properly on both big- and little-endians.
413  *
414  * (5) A reference count is held within each pix, giving the
415  * number of ptrs to the pix. When a pixClone() call
416  * is made, the ref count is increased by 1, and
417  * when a pixDestroy() call is made, the reference count
418  * of the pix is decremented. The pix is only destroyed
419  * when the reference count goes to zero.
420  *
421  * (6) The version numbers (below) are used in the serialization
422  * of these data structures. They are placed in the files,
423  * and rarely (if ever) change. Provision is currently made for
424  * backward compatibility in reading from boxaa version 2.
425  *
426  * (7) The serialization dependencies are as follows:
427  * pixaa : pixa : boxa
428  * boxaa : boxa
429  * So, for example, pixaa and boxaa can be changed without
430  * forcing a change in pixa or boxa. However, if pixa is
431  * changed, it forces a change in pixaa, and if boxa is
432  * changed, if forces a change in the other three.
433  * We define four version numbers:
434  * PIXAA_VERSION_NUMBER
435  * PIXA_VERSION_NUMBER
436  * BOXAA_VERSION_NUMBER
437  * BOXA_VERSION_NUMBER
438  * </pre>
439  *-------------------------------------------------------------------------*/
440 
441 
442 
443 /*-------------------------------------------------------------------------*
444  * Array of pix *
445  *-------------------------------------------------------------------------*/
446 
447  /* Serialization for primary data structures */
448 #define PIXAA_VERSION_NUMBER 2
449 #define PIXA_VERSION_NUMBER 2
450 #define BOXA_VERSION_NUMBER 2
451 #define BOXAA_VERSION_NUMBER 3
454 struct Pixa
455 {
456  l_int32 n;
457  l_int32 nalloc;
458  l_uint32 refcount;
459  struct Pix **pix;
460  struct Boxa *boxa;
461 };
462 typedef struct Pixa PIXA;
463 
465 struct Pixaa
466 {
467  l_int32 n;
468  l_int32 nalloc;
469  struct Pixa **pixa;
470  struct Boxa *boxa;
471 };
472 typedef struct Pixaa PIXAA;
473 
474 
475 /*-------------------------------------------------------------------------*
476  * Basic rectangle and rectangle arrays *
477  *-------------------------------------------------------------------------*/
478 
480 struct Box
481 {
482  l_int32 x;
483  l_int32 y;
484  l_int32 w;
485  l_int32 h;
486  l_uint32 refcount;
488 };
489 typedef struct Box BOX;
490 
492 struct Boxa
493 {
494  l_int32 n;
495  l_int32 nalloc;
496  l_uint32 refcount;
497  struct Box **box;
498 };
499 typedef struct Boxa BOXA;
500 
502 struct Boxaa
503 {
504  l_int32 n;
505  l_int32 nalloc;
506  struct Boxa **boxa;
507 };
508 typedef struct Boxaa BOXAA;
509 
510 
511 /*-------------------------------------------------------------------------*
512  * Array of points *
513  *-------------------------------------------------------------------------*/
514 #define PTA_VERSION_NUMBER 1
517 struct Pta
518 {
519  l_int32 n;
520  l_int32 nalloc;
521  l_uint32 refcount;
522  l_float32 *x, *y;
523 };
524 typedef struct Pta PTA;
525 
526 
527 /*-------------------------------------------------------------------------*
528  * Array of Pta *
529  *-------------------------------------------------------------------------*/
530 
532 struct Ptaa
533 {
534  l_int32 n;
535  l_int32 nalloc;
536  struct Pta **pta;
537 };
538 typedef struct Ptaa PTAA;
539 
540 
541 /*-------------------------------------------------------------------------*
542  * Pix accumulator container *
543  *-------------------------------------------------------------------------*/
544 
546 struct Pixacc
547 {
548  l_int32 w;
549  l_int32 h;
550  l_int32 offset;
552  struct Pix *pix;
553 };
554 typedef struct Pixacc PIXACC;
555 
556 
557 /*-------------------------------------------------------------------------*
558  * Pix tiling *
559  *-------------------------------------------------------------------------*/
560 
562 struct PixTiling
563 {
564  struct Pix *pix;
565  l_int32 nx;
566  l_int32 ny;
567  l_int32 w;
568  l_int32 h;
569  l_int32 xoverlap;
570  l_int32 yoverlap;
571  l_int32 strip;
572 };
573 typedef struct PixTiling PIXTILING;
574 
575 
576 /*-------------------------------------------------------------------------*
577  * FPix: pix with float array *
578  *-------------------------------------------------------------------------*/
579 #define FPIX_VERSION_NUMBER 2
582 struct FPix
583 {
584  l_int32 w;
585  l_int32 h;
586  l_int32 wpl;
587  l_uint32 refcount;
588  l_int32 xres;
590  l_int32 yres;
592  l_float32 *data;
593 };
594 typedef struct FPix FPIX;
595 
597 struct FPixa
598 {
599  l_int32 n;
600  l_int32 nalloc;
601  l_uint32 refcount;
602  struct FPix **fpix;
603 };
604 typedef struct FPixa FPIXA;
605 
606 
607 /*-------------------------------------------------------------------------*
608  * DPix: pix with double array *
609  *-------------------------------------------------------------------------*/
610 #define DPIX_VERSION_NUMBER 2
613 struct DPix
614 {
615  l_int32 w;
616  l_int32 h;
617  l_int32 wpl;
618  l_uint32 refcount;
619  l_int32 xres;
621  l_int32 yres;
623  l_float64 *data;
624 };
625 typedef struct DPix DPIX;
626 
627 
628 /*-------------------------------------------------------------------------*
629  * PixComp: compressed pix *
630  *-------------------------------------------------------------------------*/
631 
633 struct PixComp
634 {
635  l_int32 w;
636  l_int32 h;
637  l_int32 d;
638  l_int32 xres;
640  l_int32 yres;
642  l_int32 comptype;
644  char *text;
645  l_int32 cmapflag;
646  l_uint8 *data;
647  size_t size;
648 };
649 typedef struct PixComp PIXC;
650 
651 
652 /*-------------------------------------------------------------------------*
653  * PixaComp: array of compressed pix *
654  *-------------------------------------------------------------------------*/
655 #define PIXACOMP_VERSION_NUMBER 2
658 struct PixaComp
659 {
660  l_int32 n;
661  l_int32 nalloc;
662  l_int32 offset;
663  struct PixComp **pixc;
664  struct Boxa *boxa;
665 };
666 typedef struct PixaComp PIXAC;
667 
668 
669 /*-------------------------------------------------------------------------*
670  * Access and storage flags *
671  *-------------------------------------------------------------------------*/
672 /*
673  * <pre>
674  * For Pix, Box, Pta and Numa, there are 3 standard methods for handling
675  * the retrieval or insertion of a struct:
676  * (1) direct insertion (Don't do this if there is another handle
677  * somewhere to this same struct!)
678  * (2) copy (Always safe, sets up a refcount of 1 on the new object.
679  * Can be undesirable if very large, such as an image or
680  * an array of images.)
681  * (3) clone (Makes another handle to the same struct, and bumps the
682  * refcount up by 1. Safe to do unless you're changing
683  * data through one of the handles but don't want those
684  * changes to be seen by the other handle.)
685  *
686  * For Pixa and Boxa, which are structs that hold an array of clonable
687  * structs, there is an additional method:
688  * (4) copy-clone (Makes a new higher-level struct with a refcount
689  * of 1, but clones all the structs in the array.)
690  *
691  * Unlike the other structs, when retrieving a string from an Sarray,
692  * you are allowed to get a handle without a copy or clone (i.e., that
693  * you don't own!). You must not free or insert such a string!
694  * Specifically, for an Sarray, the copyflag for retrieval is either:
695  * L_COPY or L_NOCOPY
696  * and for insertion, the copyflag is either:
697  * L_COPY or one of {L_INSERT , L_NOCOPY} (the latter are equivalent
698  * for insertion))
699  * </pre>
700  */
701 
703 enum {
704  L_NOCOPY = 0,
705  L_COPY = 1,
706  L_CLONE = 2,
709 };
710 static const l_int32 L_INSERT = 0;
713 /*----------------------------------------------------------------------------*
714  * Sort flags *
715  *----------------------------------------------------------------------------*/
716 
718 enum {
721 };
722 
724 enum {
727 };
728 
730 enum {
742 };
743 
744 
745 /*---------------------------------------------------------------------------*
746  * Blend flags *
747  *---------------------------------------------------------------------------*/
748 
750 enum {
757 };
758 
759 enum {
762 };
763 
764 
765 /*-------------------------------------------------------------------------*
766  * Graphics pixel setting *
767  *-------------------------------------------------------------------------*/
768 
770 enum {
774 };
775 
776 
777 /*-------------------------------------------------------------------------*
778  * Size and location filter flags *
779  *-------------------------------------------------------------------------*/
780 
782 enum {
791 };
792 
794 enum {
799 };
800 
801 
802 /*-------------------------------------------------------------------------*
803  * Color component selection flags *
804  *-------------------------------------------------------------------------*/
805 
807 enum {
816 };
817 
818 
819 /*-------------------------------------------------------------------------*
820  * 16-bit conversion flags *
821  *-------------------------------------------------------------------------*/
822 
824 enum {
825  L_LS_BYTE = 1,
826  L_MS_BYTE = 2,
832 };
833 
834 
835 /*-------------------------------------------------------------------------*
836  * Rotate and shear flags *
837  *-------------------------------------------------------------------------*/
838 
840 enum {
844 };
845 
847 enum {
850 };
851 
853 enum {
856 };
857 
858 
859 /*-------------------------------------------------------------------------*
860  * Affine transform order flags *
861  *-------------------------------------------------------------------------*/
862 
864 enum {
871 };
872 
873 
874 /*-------------------------------------------------------------------------*
875  * Grayscale filling flags *
876  *-------------------------------------------------------------------------*/
877 
879 enum {
882 };
883 
884 
885 /*-------------------------------------------------------------------------*
886  * Flags for setting to white or black *
887  *-------------------------------------------------------------------------*/
888 
890 enum {
893 };
894 
895 
896 /*-------------------------------------------------------------------------*
897  * Flags for getting white or black value *
898  *-------------------------------------------------------------------------*/
899 
901 enum {
904 };
905 
906 
907 /*-------------------------------------------------------------------------*
908  * Flags for 8 bit and 16 bit pixel sums *
909  *-------------------------------------------------------------------------*/
910 
912 enum {
915 };
916 
917 
918 /*-------------------------------------------------------------------------*
919  * Dither parameters *
920  * If within this grayscale distance from black or white, *
921  * do not propagate excess or deficit to neighboring pixels. *
922  *-------------------------------------------------------------------------*/
923 
925 enum {
930 };
931 
932 
933 /*-------------------------------------------------------------------------*
934  * Distance flags *
935  *-------------------------------------------------------------------------*/
936 
938 enum {
941 };
942 
943 
944 /*-------------------------------------------------------------------------*
945  * Value flags *
946  *-------------------------------------------------------------------------*/
947 
949 enum {
954  L_ZERO = 5,
955  L_ALL = 6
956 };
957 
958 
959 /*-------------------------------------------------------------------------*
960  * Statistical measures *
961  *-------------------------------------------------------------------------*/
962 
964 enum {
972 };
973 
974 
975 /*-------------------------------------------------------------------------*
976  * Set selection flags *
977  *-------------------------------------------------------------------------*/
978 
980 enum {
983 };
984 
985 
986 /*-------------------------------------------------------------------------*
987  * Text orientation flags *
988  *-------------------------------------------------------------------------*/
989 
991 enum {
997 };
998 
999 
1000 /*-------------------------------------------------------------------------*
1001  * Edge orientation flags *
1002  *-------------------------------------------------------------------------*/
1003 
1005 enum {
1009 };
1010 
1011 
1012 /*-------------------------------------------------------------------------*
1013  * Line orientation flags *
1014  *-------------------------------------------------------------------------*/
1015 
1017 enum {
1023 };
1024 
1025 
1026 /*-------------------------------------------------------------------------*
1027  * Image orientation flags *
1028  *-------------------------------------------------------------------------*/
1029 
1031 enum {
1034 };
1035 
1036 
1037 /*-------------------------------------------------------------------------*
1038  * Scan direction flags *
1039  *-------------------------------------------------------------------------*/
1040 
1042 enum {
1052 };
1053 
1054 
1055 /*-------------------------------------------------------------------------*
1056  * Box size adjustment and location flags *
1057  *-------------------------------------------------------------------------*/
1058 
1060 enum {
1072  L_SET_TOP = 11,
1073  L_SET_BOT = 12,
1074  L_GET_LEFT = 13,
1076  L_GET_TOP = 15,
1078 };
1079 
1080 
1081 /*-------------------------------------------------------------------------*
1082  * Flags for modifying box boundaries using a second box *
1083  *-------------------------------------------------------------------------*/
1084 
1086 enum {
1093 };
1094 
1095 /*-------------------------------------------------------------------------*
1096  * Handling overlapping bounding boxes in boxa *
1097  *-------------------------------------------------------------------------*/
1098 
1100 enum {
1103 };
1104 
1105 /*-------------------------------------------------------------------------*
1106  * Flags for replacing invalid boxes *
1107  *-------------------------------------------------------------------------*/
1108 
1110 enum {
1113 };
1114 
1115 /*-------------------------------------------------------------------------*
1116  * Horizontal warp *
1117  *-------------------------------------------------------------------------*/
1118 
1120 enum {
1123 };
1124 
1126 enum {
1129 };
1130 
1131 
1132 /*-------------------------------------------------------------------------*
1133  * Pixel selection for resampling *
1134  *-------------------------------------------------------------------------*/
1135 
1137 enum {
1140 };
1141 
1142 
1143 /*-------------------------------------------------------------------------*
1144  * Thinning flags *
1145  *-------------------------------------------------------------------------*/
1146 
1148 enum {
1151 };
1152 
1153 
1154 /*-------------------------------------------------------------------------*
1155  * Runlength flags *
1156  *-------------------------------------------------------------------------*/
1157 
1159 enum {
1162 };
1163 
1164 
1165 /*-------------------------------------------------------------------------*
1166  * Edge filter flags *
1167  *-------------------------------------------------------------------------*/
1168 
1170 enum {
1173 };
1174 
1175 
1176 /*-------------------------------------------------------------------------*
1177  * Subpixel color component ordering in LCD display *
1178  *-------------------------------------------------------------------------*/
1179 
1181 enum {
1186 };
1187 
1188 
1189 /*-------------------------------------------------------------------------*
1190  * HSV histogram flags *
1191  *-------------------------------------------------------------------------*/
1192 
1194 enum {
1198 };
1199 
1200 
1201 /*-------------------------------------------------------------------------*
1202  * Region flags (inclusion, exclusion) *
1203  *-------------------------------------------------------------------------*/
1204 
1206 enum {
1209 };
1210 
1211 
1212 /*-------------------------------------------------------------------------*
1213  * Flags for adding text to a pix *
1214  *-------------------------------------------------------------------------*/
1215 
1217 enum {
1226 };
1227 
1228 
1229 /*-------------------------------------------------------------------------*
1230  * Flags for plotting on a pix *
1231  *-------------------------------------------------------------------------*/
1232 
1234 enum {
1241 };
1242 
1243 
1244 /*-------------------------------------------------------------------------*
1245  * Flags for selecting display program *
1246  *-------------------------------------------------------------------------*/
1247 
1249 enum {
1255 };
1256 
1257 /*-------------------------------------------------------------------------*
1258  * Flag(s) used in the 'special' pix field for non-default operations *
1259  * - 0 is default for chroma sampling in jpeg *
1260  * - 10-19 are used for zlib compression in png write *
1261  * - 4 and 8 are used for specifying connectivity in labelling *
1262  *-------------------------------------------------------------------------*/
1263 
1265 enum {
1267 };
1268 
1269 
1270 /*-------------------------------------------------------------------------*
1271  * Handling negative values in conversion to unsigned int *
1272  *-------------------------------------------------------------------------*/
1273 
1275 enum {
1278 };
1279 
1280 
1281 /*-------------------------------------------------------------------------*
1282  * Relative to zero flags *
1283  *-------------------------------------------------------------------------*/
1284 
1286 enum {
1290 };
1291 
1292 
1293 /*-------------------------------------------------------------------------*
1294  * Flags for adding or removing traling slash from string *
1295  *-------------------------------------------------------------------------*/
1296 
1298 enum {
1301 };
1302 
1303 
1304 /*-------------------------------------------------------------------------*
1305  * Pix allocator and deallocator function types *
1306  *-------------------------------------------------------------------------*/
1308 typedef void *(*alloc_fn)(size_t);
1309 
1311 typedef void (*dealloc_fn)(void *);
1312 
1313 
1314 #endif /* LEPTONICA_PIX_H */
l_uint8 alpha
Definition: pix.h:174
l_int32 xres
Definition: pix.h:142
l_uint32 * data
Definition: pix.h:150
l_int32 n
Definition: pix.h:494
l_uint32 refcount
Definition: pix.h:618
l_uint32 refcount
Definition: pix.h:496
struct FPix ** fpix
Definition: pix.h:602
l_uint32 w
Definition: pix.h:136
l_int32 w
Definition: pix.h:548
l_int32 special
Definition: pix.h:147
struct Boxa * boxa
Definition: pix.h:460
l_int32 n
Definition: pix.h:160
l_int32 yres
Definition: pix.h:621
l_int32 informat
Definition: pix.h:146
l_uint32 refcount
Definition: pix.h:587
l_int32 h
Definition: pix.h:549
static const l_float32 L_RED_WEIGHT
Definition: pix.h:243
l_uint32 refcount
Definition: pix.h:486
l_uint32 refcount
Definition: pix.h:141
Definition: pix.h:704
Definition: pix.h:955
l_int32 yres
Definition: pix.h:144
l_int32 w
Definition: pix.h:567
struct PixColormap * colormap
Definition: pix.h:149
l_int32 y
Definition: pix.h:483
l_int32 comptype
Definition: pix.h:642
struct Boxa ** boxa
Definition: pix.h:506
l_uint8 red
Definition: pix.h:173
void(* dealloc_fn)(void *)
Definition: pix.h:1311
l_int32 n
Definition: pix.h:660
l_uint32 refcount
Definition: pix.h:601
l_int32 xres
Definition: pix.h:619
l_int32 depth
Definition: pix.h:158
l_int32 strip
Definition: pix.h:571
Definition: pix.h:597
l_int32 w
Definition: pix.h:635
l_int32 nalloc
Definition: pix.h:159
l_uint32 refcount
Definition: pix.h:458
l_int32 n
Definition: pix.h:456
Definition: pix.h:492
l_int32 nalloc
Definition: pix.h:600
Definition: pix.h:562
l_int32 h
Definition: pix.h:568
l_int32 d
Definition: pix.h:637
l_uint8 blue
Definition: pix.h:171
l_int32 h
Definition: pix.h:636
Definition: pix.h:502
l_int32 nalloc
Definition: pix.h:505
l_uint32 d
Definition: pix.h:138
l_int32 wpl
Definition: pix.h:586
static const l_int32 L_INSERT
Definition: pix.h:710
l_uint32 h
Definition: pix.h:137
static const l_float32 L_GREEN_WEIGHT
Definition: pix.h:244
char * text
Definition: pix.h:148
static const l_float32 L_BLUE_WEIGHT
Definition: pix.h:245
l_int32 xoverlap
Definition: pix.h:569
l_int32 nalloc
Definition: pix.h:495
l_int32 nalloc
Definition: pix.h:535
struct Pix * pix
Definition: pix.h:564
l_int32 w
Definition: pix.h:484
l_int32 offset
Definition: pix.h:550
Definition: pix.h:532
l_int32 ny
Definition: pix.h:566
Definition: pix.h:546
l_int32 yres
Definition: pix.h:590
struct Pix ** pix
Definition: pix.h:459
Definition: pix.h:954
l_int32 nalloc
Definition: pix.h:661
l_int32 xres
Definition: pix.h:638
l_uint8 green
Definition: pix.h:172
Definition: pix.h:169
l_int32 yoverlap
Definition: pix.h:570
Definition: pix.h:658
l_int32 nalloc
Definition: pix.h:457
l_int32 n
Definition: pix.h:467
l_int32 w
Definition: pix.h:615
struct Pixa ** pixa
Definition: pix.h:469
struct Pix * pix
Definition: pix.h:552
struct Boxa * boxa
Definition: pix.h:664
l_int32 xres
Definition: pix.h:588
l_int32 x
Definition: pix.h:482
l_float64 * data
Definition: pix.h:623
Definition: pix.h:454
l_float32 * y
Definition: pix.h:522
Definition: pix.h:826
Definition: pix.h:465
l_int32 h
Definition: pix.h:616
Definition: pix.h:633
l_int32 n
Definition: pix.h:504
l_int32 yres
Definition: pix.h:640
l_int32 w
Definition: pix.h:584
char * text
Definition: pix.h:644
l_int32 h
Definition: pix.h:585
void * array
Definition: pix.h:157
Definition: pix.h:825
Definition: pix.h:705
l_int32 nalloc
Definition: pix.h:520
l_int32 h
Definition: pix.h:485
l_float32 * data
Definition: pix.h:592
l_int32 nalloc
Definition: pix.h:468
Definition: pix.h:134
Definition: pix.h:706
l_int32 cmapflag
Definition: pix.h:645
l_uint8 * data
Definition: pix.h:646
Definition: pix.h:201
l_uint32 wpl
Definition: pix.h:140
l_int32 wpl
Definition: pix.h:617
l_int32 offset
Definition: pix.h:662
struct PixComp ** pixc
Definition: pix.h:663
struct Box ** box
Definition: pix.h:497
l_int32 nx
Definition: pix.h:565
struct Boxa * boxa
Definition: pix.h:470
Definition: pix.h:480
Definition: pix.h:613
l_int32 n
Definition: pix.h:599
l_int32 n
Definition: pix.h:519
l_uint32 spp
Definition: pix.h:139
size_t size
Definition: pix.h:647
Definition: pix.h:517
l_uint32 refcount
Definition: pix.h:521
l_int32 n
Definition: pix.h:534
Definition: pix.h:582
struct Pta ** pta
Definition: pix.h:536