comparison mupdf-source/thirdparty/leptonica/src/pix.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
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
30 /*!
31 * \file pix.h
32 *
33 * <pre>
34 * Valid image types in leptonica:
35 * Pix: 1 bpp, with and without colormap
36 * Pix: 2 bpp, with and without colormap
37 * Pix: 4 bpp, with and without colormap
38 * Pix: 8 bpp, with and without colormap
39 * Pix: 16 bpp (1 spp)
40 * Pix: 32 bpp (rgb, 3 spp)
41 * Pix: 32 bpp (rgba, 4 spp)
42 * FPix: 32 bpp float
43 * DPix: 64 bpp double
44 * Notes:
45 * (1) The only valid Pix image type with alpha is rgba.
46 * In particular, the alpha component is not used in
47 * cmapped images.
48 * (2) PixComp can hold any Pix with IFF_PNG encoding.
49 *
50 * Contents:
51 *
52 * (1) This file has typedefs for most of the image-related structs
53 * used in leptonica:
54 * struct Pix
55 * struct PixColormap
56 * struct RGBA_Quad
57 * struct Pixa
58 * struct Pixaa
59 * struct Box
60 * struct Boxa
61 * struct Boxaa
62 * struct Pta
63 * struct Ptaa
64 * struct Pixacc
65 * struct PixTiling
66 * struct FPix
67 * struct FPixa
68 * struct DPix
69 * struct PixComp
70 * struct PixaComp
71 *
72 * (2) This file has definitions for:
73 * Colors for RGBA
74 * Colors for drawing boxes
75 * Perceptual color weights
76 * Colormap conversion flags
77 * Rasterop bit flags
78 * Structure access flags (for insert, copy, clone, copy-clone)
79 * Sorting flags (by type and direction)
80 * Blending flags
81 * Graphics pixel setting flags
82 * Size and location filter flags
83 * Color component selection flags
84 * Color content flags
85 * 16-bit conversion flags
86 * Rotation and shear flags
87 * Affine transform order flags
88 * Grayscale filling flags
89 * Flags for setting to white or black
90 * Flags for getting white or black pixel value
91 * Flags for 8 and 16 bit pixel sums
92 * Dithering flags
93 * Distance flags
94 * Value flags
95 * Statistical measures
96 * Set selection flags
97 * Text orientation flags
98 * Edge orientation flags
99 * Line orientation flags
100 * Image orientation flags
101 * Scan direction flags
102 * Box size adjustment flags
103 * Flags for modifying box boundaries using a second box
104 * Handling overlapping bounding boxes in boxa
105 * Selecting or making a box from two (intersecting) boxes
106 * Flags for replacing invalid boxes
107 * Flags for box corners and center
108 * Horizontal warp
109 * Pixel selection for resampling
110 * Thinning flags
111 * Runlength flags
112 * Edge filter flags
113 * Subpixel color component ordering in LCD display
114 * HSV histogram flags
115 * Region flags (inclusion, exclusion)
116 * Flags for adding text to a pix
117 * Flags for plotting on a pix
118 * Flags for making simple masks
119 * Flags for selecting display program
120 * Flags in the 'special' pix field for non-default operations
121 * Handling negative values in conversion to unsigned int
122 * Relative to zero flags
123 * Flags for adding or removing trailing slash from string
124 *
125 * (3) This file has typedefs for the pix allocator and deallocator functions
126 * alloc_fn()
127 * dealloc_fn().
128 *
129 * -------------------------------------------------------------------
130 * Notes on the pixels in the raster image. This information can also
131 * be found in pix_internal.h.
132 *
133 * (1) The image data is stored in a single contiguous
134 * array of l_uint32, into which the pixels are packed.
135 * By "packed" we mean that there are no unused bits
136 * between pixels, except for end-of-line padding to
137 * satisfy item (2) below.
138 *
139 * (2) Every image raster line begins on a 32-bit word
140 * boundary within this array.
141 *
142 * (3) Pix image data is stored in 32-bit units, with the
143 * pixels ordered from left to right in the image being
144 * stored in order from the MSB to LSB within the word,
145 * for both big-endian and little-endian machines.
146 * This is the natural ordering for big-endian machines,
147 * as successive bytes are stored and fetched progressively
148 * to the right. However, for little-endians, when storing
149 * we re-order the bytes from this byte stream order, and
150 * reshuffle again for byte access on 32-bit entities.
151 * So if the bytes come in sequence from left to right, we
152 * store them on little-endians in byte order:
153 * 3 2 1 0 7 6 5 4 ...
154 * This MSB to LSB ordering allows left and right shift
155 * operations on 32 bit words to move the pixels properly.
156 *
157 * (4) We use 32 bit pixels for both RGB and RGBA color images.
158 * The A (alpha) byte is ignored in most leptonica functions
159 * operating on color images. Within each 4 byte pixel, the
160 * color samples are ordered from MSB to LSB, as follows:
161 *
162 * | MSB | 2nd MSB | 3rd MSB | LSB |
163 * red green blue alpha
164 * 0 1 2 3 (big-endian)
165 * 3 2 1 0 (little-endian)
166 *
167 * Because we use MSB to LSB ordering within the 32-bit word,
168 * the individual 8-bit samples can be accessed with
169 * GET_DATA_BYTE and SET_DATA_BYTE macros, using the
170 * (implicitly big-ending) ordering
171 * red: byte 0 (MSB)
172 * green: byte 1 (2nd MSB)
173 * blue: byte 2 (3rd MSB)
174 * alpha: byte 3 (LSB)
175 *
176 * The specific color assignment is made in this file,
177 * through the definitions of COLOR_RED, etc. Then the R, G
178 * B and A sample values can be retrieved using
179 * redval = GET_DATA_BYTE(&pixel, COLOR_RED);
180 * greenval = GET_DATA_BYTE(&pixel, COLOR_GREEN);
181 * blueval = GET_DATA_BYTE(&pixel, COLOR_BLUE);
182 * alphaval = GET_DATA_BYTE(&pixel, L_ALPHA_CHANNEL);
183 * and they can be set with
184 * SET_DATA_BYTE(&pixel, COLOR_RED, redval);
185 * SET_DATA_BYTE(&pixel, COLOR_GREEN, greenval);
186 * SET_DATA_BYTE(&pixel, COLOR_BLUE, blueval);
187 * SET_DATA_BYTE(&pixel, L_ALPHA_CHANNEL, alphaval);
188 *
189 * More efficiently, these components can be extracted directly
190 * by shifting and masking, explicitly using the values in
191 * L_RED_SHIFT, etc.:
192 * (pixel32 >> L_RED_SHIFT) & 0xff; (red)
193 * (pixel32 >> L_GREEN_SHIFT) & 0xff; (green)
194 * (pixel32 >> L_BLUE_SHIFT) & 0xff; (blue)
195 * (pixel32 >> L_ALPHA_SHIFT) & 0xff; (alpha)
196 * The functions extractRGBValues() and extractRGBAValues() are
197 * provided to do this. Likewise, the pixels can be set
198 * directly by shifting, using composeRGBPixel() and
199 * composeRGBAPixel().
200 *
201 * All these operations work properly on both big- and little-endians.
202 *
203 * (5) A reference count is held within each pix, giving the
204 * number of ptrs to the pix. When a pixClone() call
205 * is made, the ref count is increased by 1, and
206 * when a pixDestroy() call is made, the reference count
207 * of the pix is decremented. The pix is only destroyed
208 * when the reference count goes to zero.
209 *
210 * (6) Version numbers are used in the serialization of image-related
211 * data structures. They are placed in the files, and rarely
212 * (if ever) change.
213 *
214 * (7) The serialization dependencies are as follows:
215 * pixaa : pixa : boxa
216 * boxaa : boxa
217 * So, for example, pixaa and boxaa can be changed without
218 * forcing a change in pixa or boxa. However, if pixa is
219 * changed, it forces a change in pixaa, and if boxa is
220 * changed, if forces a change in the other three.
221 * </pre>
222 */
223
224 /*-------------------------------------------------------------------------*
225 * Basic Pix *
226 *-------------------------------------------------------------------------*/
227 /*! Basic Pix */
228 typedef struct Pix PIX;
229
230 /*! Colormap of a Pix */
231 typedef struct PixColormap PIXCMAP;
232
233 /*! Colormap table entry (after the BMP version).
234 * Note that the BMP format stores the colormap table exactly
235 * as it appears here, with color samples being stored sequentially,
236 * in the order (b,g,r,a). */
237 typedef struct RGBA_Quad RGBA_QUAD;
238
239 /*-------------------------------------------------------------------------*
240 * Pix arrays *
241 *-------------------------------------------------------------------------*/
242 /*! Array of pix */
243 typedef struct Pixa PIXA;
244
245 /*! Array of arrays of pix */
246 typedef struct Pixaa PIXAA;
247
248 /*-------------------------------------------------------------------------*
249 * Basic rectangle and rectangle arrays *
250 *-------------------------------------------------------------------------*/
251 /*! Basic rectangle */
252 typedef struct Box BOX;
253
254 /*! Array of Box */
255 typedef struct Boxa BOXA;
256
257 /*! Array of Boxa */
258 typedef struct Boxaa BOXAA;
259
260 /*-------------------------------------------------------------------------*
261 * Arrays of points *
262 *-------------------------------------------------------------------------*/
263 /*! Array of points */
264 typedef struct Pta PTA;
265
266 /*! Array of Pta */
267 typedef struct Ptaa PTAA;
268
269 /*-------------------------------------------------------------------------*
270 * Pix accumulator container *
271 *-------------------------------------------------------------------------*/
272 /*! Pix accumulator container */
273 typedef struct Pixacc PIXACC;
274
275 /*-------------------------------------------------------------------------*
276 * Pix tiling *
277 *-------------------------------------------------------------------------*/
278 /*! Pix tiling */
279 typedef struct PixTiling PIXTILING;
280
281 /*-------------------------------------------------------------------------*
282 * FPix: pix with float array *
283 *-------------------------------------------------------------------------*/
284 /*! Pix with float array */
285 typedef struct FPix FPIX;
286
287 /*! Array of FPix */
288 typedef struct FPixa FPIXA;
289
290 /*-------------------------------------------------------------------------*
291 * DPix: pix with double array *
292 *-------------------------------------------------------------------------*/
293 /*! Pix with double array */
294 typedef struct DPix DPIX;
295
296 /*-------------------------------------------------------------------------*
297 * Compressed pix and arrays *
298 *-------------------------------------------------------------------------*/
299 /*! Compressed Pix */
300 typedef struct PixComp PIXC;
301
302 /*! Array of compressed pix */
303 typedef struct PixaComp PIXAC;
304
305
306
307 /*-------------------------------------------------------------------------*
308 * Colors for 32 RGBA *
309 *-------------------------------------------------------------------------*/
310 /* <pre>
311 * Notes:
312 * (1) These are the byte indices for colors in 32 bpp images.
313 * They are used through the GET/SET_DATA_BYTE accessors.
314 * The 4th byte, typically known as the "alpha channel" and used
315 * for blending, is used to a small extent in leptonica.
316 * (2) Do not change these values! If you redefine them, functions
317 * that have the shifts hardcoded for efficiency and conciseness
318 * (instead of using the constants below) will break. These
319 * functions are labelled with "***" next to their names at
320 * the top of the files in which they are defined.
321 * (3) The shifts to extract the red, green, blue and alpha components
322 * from a 32 bit pixel are defined here.
323 * </pre>
324 */
325
326 /*! RGBA Color */
327 enum {
328 COLOR_RED = 0, /*!< red color index in RGBA_QUAD */
329 COLOR_GREEN = 1, /*!< green color index in RGBA_QUAD */
330 COLOR_BLUE = 2, /*!< blue color index in RGBA_QUAD */
331 L_ALPHA_CHANNEL = 3 /*!< alpha value index in RGBA_QUAD */
332 };
333
334 static const l_int32 L_RED_SHIFT =
335 8 * (sizeof(l_uint32) - 1 - COLOR_RED); /* 24 */
336 static const l_int32 L_GREEN_SHIFT =
337 8 * (sizeof(l_uint32) - 1 - COLOR_GREEN); /* 16 */
338 static const l_int32 L_BLUE_SHIFT =
339 8 * (sizeof(l_uint32) - 1 - COLOR_BLUE); /* 8 */
340 static const l_int32 L_ALPHA_SHIFT =
341 8 * (sizeof(l_uint32) - 1 - L_ALPHA_CHANNEL); /* 0 */
342
343
344 /*-------------------------------------------------------------------------*
345 * Colors for drawing boxes *
346 *-------------------------------------------------------------------------*/
347 /*! Box Color */
348 enum {
349 L_DRAW_RED = 0, /*!< draw in red */
350 L_DRAW_GREEN = 1, /*!< draw in green */
351 L_DRAW_BLUE = 2, /*!< draw in blue */
352 L_DRAW_SPECIFIED = 3, /*!< draw specified color */
353 L_DRAW_RGB = 4, /*!< draw as sequence of r,g,b */
354 L_DRAW_RANDOM = 5 /*!< draw randomly chosen colors */
355 };
356
357
358 /*-------------------------------------------------------------------------*
359 * Perceptual color weights *
360 *-------------------------------------------------------------------------*/
361 /* <pre>
362 * Notes:
363 * (1) These perceptual weighting factors are ad-hoc, but they do
364 * add up to 1. Unlike, for example, the weighting factors for
365 * converting RGB to luminance, or more specifically to Y in the
366 * YUV colorspace. Those numbers come from the
367 * International Telecommunications Union, via ITU-R.
368 * </pre>
369 */
370 static const l_float32 L_RED_WEIGHT = 0.3f; /*!< Percept. weight for red */
371 static const l_float32 L_GREEN_WEIGHT = 0.5f; /*!< Percept. weight for green */
372 static const l_float32 L_BLUE_WEIGHT = 0.2f; /*!< Percept. weight for blue */
373
374
375 /*-------------------------------------------------------------------------*
376 * Flags for colormap conversion *
377 *-------------------------------------------------------------------------*/
378 /*! Cmap Conversion */
379 enum {
380 REMOVE_CMAP_TO_BINARY = 0, /*!< remove colormap for conv to 1 bpp */
381 REMOVE_CMAP_TO_GRAYSCALE = 1, /*!< remove colormap for conv to 8 bpp */
382 REMOVE_CMAP_TO_FULL_COLOR = 2, /*!< remove colormap for conv to 32 bpp */
383 REMOVE_CMAP_WITH_ALPHA = 3, /*!< remove colormap and alpha */
384 REMOVE_CMAP_BASED_ON_SRC = 4 /*!< remove depending on src format */
385 };
386
387
388 /*------------------------------------------------------------------------*
389 *!
390 * <pre>
391 * The following operation bit flags have been modified from Sun's
392 * original "bitblt" (bit block transfer) operations (from the 1980s).
393 *
394 * The 'op' in 'rasterop' is represented by an integer
395 * composed with Boolean functions using the set of five integers
396 * given below. The integers, and the op codes resulting from
397 * boolean expressions on them, need only be in the range from 0 to 15.
398 * The function is applied on a per-pixel basis.
399 *
400 * Examples: the op code representing ORing the src and dest
401 * is computed using the bit OR, as PIX_SRC | PIX_DST; the op
402 * code representing XORing src and dest is found from
403 * PIX_SRC ^ PIX_DST; the op code representing ANDing src and dest
404 * is found from PIX_SRC & PIX_DST. Note that
405 * PIX_NOT(PIX_CLR) = PIX_SET, and v.v., as they must be.
406 *
407 * We use the following set of definitions:
408 *
409 * #define PIX_SRC 0xc
410 * #define PIX_DST 0xa
411 * #define PIX_NOT(op) (op) ^ 0xf
412 * #define PIX_CLR 0x0
413 * #define PIX_SET 0xf
414 *
415 * [These definitions differ from Sun's, in that Sun left-shifted
416 * each value by 1 pixel, and used the least significant bit as a
417 * flag for the "pseudo-operation" of clipping. We don't need
418 * this bit, because it is both efficient and safe ALWAYS to clip
419 * the rectangles to the src and dest images, which is what we do.
420 * See the notes in rop.h on the general choice of these bit flags.]
421 *
422 * Here are the 16 unique op flags:
423 *
424 * PIX_CLR 0000 0x0
425 * PIX_SET 1111 0xf
426 * PIX_SRC 1100 0xc
427 * PIX_DST 1010 0xa
428 * PIX_NOT(PIX_SRC) 0011 0x3
429 * PIX_NOT(PIX_DST) 0101 0x5
430 * PIX_SRC | PIX_DST 1110 0xe
431 * PIX_SRC & PIX_DST 1000 0x8
432 * PIX_SRC ^ PIX_DST 0110 0x6
433 * PIX_NOT(PIX_SRC) | PIX_DST 1011 0xb
434 * PIX_NOT(PIX_SRC) & PIX_DST 0010 0x2
435 * PIX_SRC | PIX_NOT(PIX_DST) 1101 0xd
436 * PIX_SRC & PIX_NOT(PIX_DST) 0100 0x4
437 * PIX_NOT(PIX_SRC | PIX_DST) 0001 0x1
438 * PIX_NOT(PIX_SRC & PIX_DST) 0111 0x7
439 * PIX_NOT(PIX_SRC ^ PIX_DST) 1001 0x9
440 *
441 * </pre>
442 *-------------------------------------------------------------------------*/
443
444 #define PIX_SRC (0xc) /*!< use source pixels */
445 #define PIX_DST (0xa) /*!< use destination pixels */
446 #define PIX_NOT(op) ((op) ^ 0x0f) /*!< invert operation %op */
447 #define PIX_CLR (0x0) /*!< clear pixels */
448 #define PIX_SET (0xf) /*!< set pixels */
449
450 #define PIX_PAINT (PIX_SRC | PIX_DST) /*!< paint = src | dst */
451 #define PIX_MASK (PIX_SRC & PIX_DST) /*!< mask = src & dst */
452 #define PIX_SUBTRACT (PIX_DST & PIX_NOT(PIX_SRC)) /*!< subtract = */
453 /*!< src & !dst */
454 #define PIX_XOR (PIX_SRC ^ PIX_DST) /*!< xor = src ^ dst */
455
456
457 /*-------------------------------------------------------------------------*
458 * Access and storage flags *
459 *-------------------------------------------------------------------------*/
460 /*
461 * <pre>
462 * For Pix, Box, Pta and Numa, there are 3 standard methods for handling
463 * the retrieval or insertion of a struct:
464 * (1) direct insertion (Don't do this if there is another handle
465 * somewhere to this same struct!)
466 * (2) copy (Always safe, sets up a refcount of 1 on the new object.
467 * Can be undesirable if very large, such as an image or
468 * an array of images.)
469 * (3) clone (Makes another handle to the same struct, and bumps the
470 * refcount up by 1. OK to use except in two situations:
471 * (a) You change data through one of the handles but don't
472 * want those changes to be seen by the other handle.
473 * (b) The application is multi-threaded. Because the clone
474 * operation is not atomic (e.g., locked with a mutex),
475 * it is possible to end up with an incorrect ref count,
476 * causing either a memory leak or a crash.
477 *
478 * For Pixa and Boxa, which are structs that hold an array of clonable
479 * structs, there is an additional method:
480 * (4) copy-clone (Makes a new higher-level struct with a refcount
481 * of 1, but clones all the structs in the array.)
482 *
483 * Unlike the other structs, when retrieving a string from an Sarray,
484 * you are allowed to get a handle without a copy or clone (i.e., the
485 * string is not owned by the handle). You must not either free the string
486 * or insert it in some other struct that would own it. Specifically,
487 * for an Sarray, the copyflag for retrieval is either:
488 * L_COPY or L_NOCOPY
489 * and for insertion, the copyflag is either:
490 * L_COPY or one of {L_INSERT , L_NOCOPY} (the latter are equivalent
491 * for insertion))
492 * Typical patterns are:
493 * (1) Reference a string in an Sarray with L_NOCOPY and insert a copy
494 * of it in another Sarray with L_COPY.
495 * (2) Copy a string from an Sarray with L_COPY and insert it in
496 * another Sarray with L_INSERT (or L_NOCOPY).
497 * In both cases, a copy is made and both Sarrays own their instance
498 * of that string.
499 * </pre>
500 */
501 /*! Object Access */
502 enum {
503 L_NOCOPY = 0, /*!< do not copy the object; do not delete the ptr */
504 L_INSERT = L_NOCOPY, /*!< stuff it in; do not copy or clone */
505 L_COPY = 1, /*!< make/use a copy of the object */
506 L_CLONE = 2, /*!< make/use clone (ref count) of the object */
507 L_COPY_CLONE = 3 /*!< make a new array object (e.g., pixa) and fill */
508 /*!< the array with clones (e.g., pix) */
509 };
510
511 /*----------------------------------------------------------------------------*
512 * Sort flags *
513 *----------------------------------------------------------------------------*/
514 /*! Sort Mode */
515 enum {
516 L_SHELL_SORT = 1, /*!< use shell sort */
517 L_BIN_SORT = 2 /*!< use bin sort */
518 };
519
520 /*! Sort Order */
521 enum {
522 L_SORT_INCREASING = 1, /*!< sort in increasing order */
523 L_SORT_DECREASING = 2 /*!< sort in decreasing order */
524 };
525
526 /*! Sort Type */
527 enum {
528 L_SORT_BY_X = 1, /*!< sort box or c.c. by left edge location */
529 L_SORT_BY_Y = 2, /*!< sort box or c.c. by top edge location */
530 L_SORT_BY_RIGHT = 3, /*!< sort box or c.c. by right edge location */
531 L_SORT_BY_BOT = 4, /*!< sort box or c.c. by bot edge location */
532 L_SORT_BY_WIDTH = 5, /*!< sort box or c.c. by width */
533 L_SORT_BY_HEIGHT = 6, /*!< sort box or c.c. by height */
534 L_SORT_BY_MIN_DIMENSION = 7, /*!< sort box or c.c. by min dimension */
535 L_SORT_BY_MAX_DIMENSION = 8, /*!< sort box or c.c. by max dimension */
536 L_SORT_BY_PERIMETER = 9, /*!< sort box or c.c. by perimeter */
537 L_SORT_BY_AREA = 10, /*!< sort box or c.c. by area */
538 L_SORT_BY_ASPECT_RATIO = 11 /*!< sort box or c.c. by width/height ratio */
539 };
540
541 /*---------------------------------------------------------------------------*
542 * Blend flags *
543 *---------------------------------------------------------------------------*/
544 /*! Blend Types */
545 enum {
546 L_BLEND_WITH_INVERSE = 1, /*!< add some of src inverse to itself */
547 L_BLEND_TO_WHITE = 2, /*!< shift src colors towards white */
548 L_BLEND_TO_BLACK = 3, /*!< shift src colors towards black */
549 L_BLEND_GRAY = 4, /*!< blend src directly with blender */
550 L_BLEND_GRAY_WITH_INVERSE = 5 /*!< add amount of src inverse to itself, */
551 /*!< based on blender pix value */
552 };
553
554 /*! Paint Selection */
555 enum {
556 L_PAINT_LIGHT = 1, /*!< colorize non-black pixels */
557 L_PAINT_DARK = 2 /*!< colorize non-white pixels */
558 };
559
560 /*-------------------------------------------------------------------------*
561 * Graphics pixel setting *
562 *-------------------------------------------------------------------------*/
563 /*! Pixel Setting */
564 enum {
565 L_SET_PIXELS = 1, /*!< set all bits in each pixel to 1 */
566 L_CLEAR_PIXELS = 2, /*!< set all bits in each pixel to 0 */
567 L_FLIP_PIXELS = 3 /*!< flip all bits in each pixel */
568 };
569
570 /*-------------------------------------------------------------------------*
571 * Size and location filter flags *
572 *-------------------------------------------------------------------------*/
573 /*! Size Comparison */
574 enum {
575 L_SELECT_IF_LT = 1, /*!< save if value is less than threshold */
576 L_SELECT_IF_GT = 2, /*!< save if value is more than threshold */
577 L_SELECT_IF_LTE = 3, /*!< save if value is <= to the threshold */
578 L_SELECT_IF_GTE = 4 /*!< save if value is >= to the threshold */
579 };
580
581 /*! Size Selection */
582 enum {
583 L_SELECT_BY_WIDTH = 1, /*!< select by width; 1 bpp */
584 L_SELECT_BY_HEIGHT = 2, /*!< select by height; 1 bpp */
585 L_SELECT_BY_MAX_DIMENSION = 3, /*!< select by max of width and */
586 /*!< height; 1 bpp */
587 L_SELECT_BY_AREA = 4, /*!< select by foreground area; 1 bpp */
588 L_SELECT_BY_PERIMETER = 5 /*!< select by perimeter; 1 bpp */
589 };
590
591 /*! Location Filter */
592 enum {
593 L_SELECT_WIDTH = 1, /*!< width must satisfy constraint */
594 L_SELECT_HEIGHT = 2, /*!< height must satisfy constraint */
595 L_SELECT_XVAL = 3, /*!< x value must satisfy constraint */
596 L_SELECT_YVAL = 4, /*!< y value must satisfy constraint */
597 L_SELECT_IF_EITHER = 5, /*!< either width or height (or xval */
598 /*!< or yval) can satisfy constraint */
599 L_SELECT_IF_BOTH = 6 /*!< both width and height (or xval */
600 /*!< and yval must satisfy constraint */
601 };
602
603 /*! Boxa Check */
604 enum {
605 L_CHECK_WIDTH = 1, /*!< check and possibly modify width */
606 L_CHECK_HEIGHT = 2, /*!< check and possibly modify height */
607 L_CHECK_BOTH = 3 /*!< check and possibly modify both */
608 };
609
610 /*-------------------------------------------------------------------------*
611 * Color component selection flags *
612 *-------------------------------------------------------------------------*/
613 /*! Color Selection */
614 enum {
615 L_SELECT_RED = 1, /*!< use red component */
616 L_SELECT_GREEN = 2, /*!< use green component */
617 L_SELECT_BLUE = 3, /*!< use blue component */
618 L_SELECT_MIN = 4, /*!< use min color component */
619 L_SELECT_MAX = 5, /*!< use max color component */
620 L_SELECT_AVERAGE = 6, /*!< use average of color components */
621 L_SELECT_HUE = 7, /*!< use hue value (in HSV color space) */
622 L_SELECT_SATURATION = 8, /*!< use saturation value (in HSV space) */
623 L_SELECT_WEIGHTED = 9 /*!< use weighted average of color comps */
624 };
625
626 /*-------------------------------------------------------------------------*
627 * Color content flags *
628 *-------------------------------------------------------------------------*/
629 /*! Color Content */
630 enum {
631 L_INTERMED_DIFF = 1, /*!< intermediate of diff component values */
632 L_AVE_MAX_DIFF_2 = 2, /*!< diff average closest comps to third */
633 L_MAX_DIFF = 3 /*!< maximum diff of component values */
634 };
635
636 /*-------------------------------------------------------------------------*
637 * 16-bit conversion flags *
638 *-------------------------------------------------------------------------*/
639 /*! 16-bit Conversion */
640 enum {
641 L_LS_BYTE = 1, /*!< use LSB */
642 L_MS_BYTE = 2, /*!< use MSB */
643 L_AUTO_BYTE = 3, /*!< use LSB if max(val) < 256; else MSB */
644 L_CLIP_TO_FF = 4, /*!< use max(val, 255) */
645 L_LS_TWO_BYTES = 5, /*!< use two LSB */
646 L_MS_TWO_BYTES = 6, /*!< use two MSB */
647 L_CLIP_TO_FFFF = 7 /*!< use max(val, 65535) */
648 };
649
650 /*-------------------------------------------------------------------------*
651 * Rotate and shear flags *
652 *-------------------------------------------------------------------------*/
653 /*! Rotation Type */
654 enum {
655 L_ROTATE_AREA_MAP = 1, /*!< use area map rotation, if possible */
656 L_ROTATE_SHEAR = 2, /*!< use shear rotation */
657 L_ROTATE_SAMPLING = 3 /*!< use sampling */
658 };
659
660 /*! Background Color */
661 enum {
662 L_BRING_IN_WHITE = 1, /*!< bring in white pixels from the outside */
663 L_BRING_IN_BLACK = 2 /*!< bring in black pixels from the outside */
664 };
665
666 /*! Shear Point */
667 enum {
668 L_SHEAR_ABOUT_CORNER = 1, /*!< shear image about UL corner */
669 L_SHEAR_ABOUT_CENTER = 2 /*!< shear image about center */
670 };
671
672 /*-------------------------------------------------------------------------*
673 * Affine transform order flags *
674 *-------------------------------------------------------------------------*/
675 /*! Affine Transform Order */
676 enum {
677 L_TR_SC_RO = 1, /*!< translate, scale, rotate */
678 L_SC_RO_TR = 2, /*!< scale, rotate, translate */
679 L_RO_TR_SC = 3, /*!< rotate, translate, scale */
680 L_TR_RO_SC = 4, /*!< translate, rotate, scale */
681 L_RO_SC_TR = 5, /*!< rotate, scale, translate */
682 L_SC_TR_RO = 6 /*!< scale, translate, rotate */
683 };
684
685 /*-------------------------------------------------------------------------*
686 * Grayscale filling flags *
687 *-------------------------------------------------------------------------*/
688 /*! Grayscale Fill */
689 enum {
690 L_FILL_WHITE = 1, /*!< fill white pixels (e.g, in fg map) */
691 L_FILL_BLACK = 2 /*!< fill black pixels (e.g., in bg map) */
692 };
693
694 /*-------------------------------------------------------------------------*
695 * Flags for setting to white or black *
696 *-------------------------------------------------------------------------*/
697 /*! BlackWhite Set */
698 enum {
699 L_SET_WHITE = 1, /*!< set pixels to white */
700 L_SET_BLACK = 2 /*!< set pixels to black */
701 };
702
703 /*-------------------------------------------------------------------------*
704 * Flags for getting white or black value *
705 *-------------------------------------------------------------------------*/
706 /*! BlackWhite Get */
707 enum {
708 L_GET_WHITE_VAL = 1, /*!< get white pixel value */
709 L_GET_BLACK_VAL = 2 /*!< get black pixel value */
710 };
711
712 /*-------------------------------------------------------------------------*
713 * Flags for 8 bit and 16 bit pixel sums *
714 *-------------------------------------------------------------------------*/
715 /*! BlackWhite Sum */
716 enum {
717 L_WHITE_IS_MAX = 1, /*!< white pixels are 0xff or 0xffff; black are 0 */
718 L_BLACK_IS_MAX = 2 /*!< black pixels are 0xff or 0xffff; white are 0 */
719 };
720
721 /*-------------------------------------------------------------------------*
722 * Dither parameters *
723 * If within this grayscale distance from black or white, *
724 * do not propagate excess or deficit to neighboring pixels. *
725 *-------------------------------------------------------------------------*/
726 /*! Dither Distance */
727 enum {
728 DEFAULT_CLIP_LOWER_1 = 10, /*!< dist to black with no prop; 1 bpp */
729 DEFAULT_CLIP_UPPER_1 = 10, /*!< dist to black with no prop; 1 bpp */
730 DEFAULT_CLIP_LOWER_2 = 5, /*!< dist to black with no prop; 2 bpp */
731 DEFAULT_CLIP_UPPER_2 = 5 /*!< dist to black with no prop; 2 bpp */
732 };
733
734 /*-------------------------------------------------------------------------*
735 * Distance type flags *
736 *-------------------------------------------------------------------------*/
737 /*! Distance Type */
738 enum {
739 L_MANHATTAN_DISTANCE = 1, /*!< L1 distance (e.g., in color space) */
740 L_EUCLIDEAN_DISTANCE = 2 /*!< L2 distance */
741 };
742
743 /*-------------------------------------------------------------------------*
744 * Distance Value flags *
745 *-------------------------------------------------------------------------*/
746 /*! Distance Value */
747 enum {
748 L_NEGATIVE = 1, /*!< values < 0 */
749 L_NON_NEGATIVE = 2, /*!< values >= 0 */
750 L_POSITIVE = 3, /*!< values > 0 */
751 L_NON_POSITIVE = 4, /*!< values <= 0 */
752 L_ZERO = 5, /*!< values = 0 */
753 L_ALL = 6 /*!< all values */
754 };
755
756 /*-------------------------------------------------------------------------*
757 * Statistical measures *
758 *-------------------------------------------------------------------------*/
759 /*! Stats Type */
760 enum {
761 L_MEAN_ABSVAL = 1, /*!< average of abs values */
762 L_MEDIAN_VAL = 2, /*!< median value of set */
763 L_MODE_VAL = 3, /*!< mode value of set */
764 L_MODE_COUNT = 4, /*!< mode count of set */
765 L_ROOT_MEAN_SQUARE = 5, /*!< rms of values */
766 L_STANDARD_DEVIATION = 6, /*!< standard deviation from mean */
767 L_VARIANCE = 7 /*!< variance of values */
768 };
769
770 /*-------------------------------------------------------------------------*
771 * Set index selection flags *
772 *-------------------------------------------------------------------------*/
773 /*! Index Selection */
774 enum {
775 L_CHOOSE_CONSECUTIVE = 1, /*!< select 'n' consecutive */
776 L_CHOOSE_SKIP_BY = 2 /*!< select at intervals of 'n' */
777 };
778
779 /*-------------------------------------------------------------------------*
780 * Text orientation flags *
781 *-------------------------------------------------------------------------*/
782 /*! Text Orientation */
783 enum {
784 L_TEXT_ORIENT_UNKNOWN = 0, /*!< low confidence on text orientation */
785 L_TEXT_ORIENT_UP = 1, /*!< portrait, text rightside-up */
786 L_TEXT_ORIENT_LEFT = 2, /*!< landscape, text up to left */
787 L_TEXT_ORIENT_DOWN = 3, /*!< portrait, text upside-down */
788 L_TEXT_ORIENT_RIGHT = 4 /*!< landscape, text up to right */
789 };
790
791 /*-------------------------------------------------------------------------*
792 * Edge orientation flags *
793 *-------------------------------------------------------------------------*/
794 /*! Edge Orientation */
795 enum {
796 L_HORIZONTAL_EDGES = 0, /*!< filters for horizontal edges */
797 L_VERTICAL_EDGES = 1, /*!< filters for vertical edges */
798 L_ALL_EDGES = 2 /*!< filters for all edges */
799 };
800
801 /*-------------------------------------------------------------------------*
802 * Line orientation flags *
803 *-------------------------------------------------------------------------*/
804 /*! Line Orientation */
805 enum {
806 L_HORIZONTAL_LINE = 0, /*!< horizontal line */
807 L_POS_SLOPE_LINE = 1, /*!< 45 degree line with positive slope */
808 L_VERTICAL_LINE = 2, /*!< vertical line */
809 L_NEG_SLOPE_LINE = 3, /*!< 45 degree line with negative slope */
810 L_OBLIQUE_LINE = 4 /*!< neither horizontal nor vertical */
811 };
812
813 /*-------------------------------------------------------------------------*
814 * Image orientation flags *
815 *-------------------------------------------------------------------------*/
816 /*! Image Orientation */
817 enum {
818 L_PORTRAIT_MODE = 0, /*!< typical: page is viewed with height > width */
819 L_LANDSCAPE_MODE = 1 /*!< page is viewed at 90 deg to portrait mode */
820 };
821
822 /*-------------------------------------------------------------------------*
823 * Scan direction flags *
824 *-------------------------------------------------------------------------*/
825 /*! Scan Direction */
826 enum {
827 L_FROM_LEFT = 0, /*!< scan from left */
828 L_FROM_RIGHT = 1, /*!< scan from right */
829 L_FROM_TOP = 2, /*!< scan from top */
830 L_FROM_BOT = 3, /*!< scan from bottom */
831 L_SCAN_NEGATIVE = 4, /*!< scan in negative direction */
832 L_SCAN_POSITIVE = 5, /*!< scan in positive direction */
833 L_SCAN_BOTH = 6, /*!< scan in both directions */
834 L_SCAN_HORIZONTAL = 7, /*!< horizontal scan (direction unimportant) */
835 L_SCAN_VERTICAL = 8 /*!< vertical scan (direction unimportant) */
836 };
837
838 /*-------------------------------------------------------------------------*
839 * Box size adjustment and location flags *
840 *-------------------------------------------------------------------------*/
841 /*! Box Adjustment */
842 enum {
843 L_ADJUST_SKIP = 0, /*!< do not adjust */
844 L_ADJUST_LEFT = 1, /*!< adjust left edge */
845 L_ADJUST_RIGHT = 2, /*!< adjust right edge */
846 L_ADJUST_LEFT_AND_RIGHT = 3, /*!< adjust both left and right edges */
847 L_ADJUST_TOP = 4, /*!< adjust top edge */
848 L_ADJUST_BOT = 5, /*!< adjust bottom edge */
849 L_ADJUST_TOP_AND_BOT = 6, /*!< adjust both top and bottom edges */
850 L_ADJUST_CHOOSE_MIN = 7, /*!< choose the min median value */
851 L_ADJUST_CHOOSE_MAX = 8, /*!< choose the max median value */
852 L_SET_LEFT = 9, /*!< set left side to a given value */
853 L_SET_RIGHT = 10, /*!< set right side to a given value */
854 L_SET_TOP = 11, /*!< set top side to a given value */
855 L_SET_BOT = 12, /*!< set bottom side to a given value */
856 L_GET_LEFT = 13, /*!< get left side location */
857 L_GET_RIGHT = 14, /*!< get right side location */
858 L_GET_TOP = 15, /*!< get top side location */
859 L_GET_BOT = 16 /*!< get bottom side location */
860 };
861
862 /*-------------------------------------------------------------------------*
863 * Flags for modifying box boundaries using a second box *
864 *-------------------------------------------------------------------------*/
865 /*! Box Boundary Mod */
866 enum {
867 L_USE_MINSIZE = 1, /*!< use boundaries giving min size */
868 L_USE_MAXSIZE = 2, /*!< use boundaries giving max size */
869 L_SUB_ON_LOC_DIFF = 3, /*!< modify boundary if big location diff */
870 L_SUB_ON_SIZE_DIFF = 4, /*!< modify boundary if big size diff */
871 L_USE_CAPPED_MIN = 5, /*!< modify boundary with capped min */
872 L_USE_CAPPED_MAX = 6 /*!< modify boundary with capped max */
873 };
874
875 /*-------------------------------------------------------------------------*
876 * Handling overlapping bounding boxes in boxa *
877 *-------------------------------------------------------------------------*/
878 /*! Box Overlap Mod */
879 enum {
880 L_COMBINE = 1, /*!< resize to bounding region; remove smaller */
881 L_REMOVE_SMALL = 2 /*!< only remove smaller */
882 };
883
884 /*-------------------------------------------------------------------------*
885 * Selecting or making a box from two (intersecting) boxes *
886 *-------------------------------------------------------------------------*/
887 /*! Box Combine or Select */
888 enum {
889 L_GEOMETRIC_UNION = 1, /*!< use union of two boxes */
890 L_GEOMETRIC_INTERSECTION = 2, /*!< use intersection of two boxes */
891 L_LARGEST_AREA = 3, /*!< use box with largest area */
892 L_SMALLEST_AREA = 4 /*!< use box with smallest area */
893 };
894
895 /*-------------------------------------------------------------------------*
896 * Flags for replacing invalid boxes *
897 *-------------------------------------------------------------------------*/
898 /*! Box Replacement */
899 enum {
900 L_USE_ALL_BOXES = 1, /*!< consider all boxes in the sequence */
901 L_USE_SAME_PARITY_BOXES = 2 /*!< consider boxes with the same parity */
902 };
903
904 /*-------------------------------------------------------------------------*
905 * Flags for box corners and center *
906 *-------------------------------------------------------------------------*/
907 /*! Box Corners and Center */
908 enum {
909 L_UPPER_LEFT = 1, /*!< UL corner */
910 L_UPPER_RIGHT = 2, /*!< UR corner */
911 L_LOWER_LEFT = 3, /*!< LL corner */
912 L_LOWER_RIGHT = 4, /*!< LR corner */
913 L_BOX_CENTER = 5 /*!< center */
914 };
915
916 /*-------------------------------------------------------------------------*
917 * Horizontal warp *
918 *-------------------------------------------------------------------------*/
919 /*! Horiz Warp Stretch */
920 enum {
921 L_WARP_TO_LEFT = 1, /*!< increasing stretch or contraction to left */
922 L_WARP_TO_RIGHT = 2 /*!< increasing stretch or contraction to right */
923 };
924
925 /*! Horiz Warp Mode */
926 enum {
927 L_LINEAR_WARP = 1, /*!< stretch or contraction grows linearly */
928 L_QUADRATIC_WARP = 2 /*!< stretch or contraction grows quadratically */
929 };
930
931 /*-------------------------------------------------------------------------*
932 * Pixel selection for resampling *
933 *-------------------------------------------------------------------------*/
934 /*! Pixel Selection */
935 enum {
936 L_INTERPOLATED = 1, /*!< linear interpolation from src pixels */
937 L_SAMPLED = 2 /*!< nearest src pixel sampling only */
938 };
939
940 /*-------------------------------------------------------------------------*
941 * Thinning flags *
942 *-------------------------------------------------------------------------*/
943 /*! Thinning Polarity */
944 enum {
945 L_THIN_FG = 1, /*!< thin foreground of 1 bpp image */
946 L_THIN_BG = 2 /*!< thin background of 1 bpp image */
947 };
948
949 /*-------------------------------------------------------------------------*
950 * Runlength flags *
951 *-------------------------------------------------------------------------*/
952 /*! Runlength Direction */
953 enum {
954 L_HORIZONTAL_RUNS = 0, /*!< determine runlengths of horizontal runs */
955 L_VERTICAL_RUNS = 1 /*!< determine runlengths of vertical runs */
956 };
957
958 /*-------------------------------------------------------------------------*
959 * Edge filter flags *
960 *-------------------------------------------------------------------------*/
961 /*! Edge Filter */
962 enum {
963 L_SOBEL_EDGE = 1, /*!< Sobel edge filter */
964 L_TWO_SIDED_EDGE = 2 /*!< Two-sided edge filter */
965 };
966
967 /*-------------------------------------------------------------------------*
968 * Subpixel color component ordering in LCD display *
969 *-------------------------------------------------------------------------*/
970 /*! Subpixel Color Order */
971 enum {
972 L_SUBPIXEL_ORDER_RGB = 1, /*!< sensor order left-to-right RGB */
973 L_SUBPIXEL_ORDER_BGR = 2, /*!< sensor order left-to-right BGR */
974 L_SUBPIXEL_ORDER_VRGB = 3, /*!< sensor order top-to-bottom RGB */
975 L_SUBPIXEL_ORDER_VBGR = 4 /*!< sensor order top-to-bottom BGR */
976 };
977
978 /*-------------------------------------------------------------------------*
979 * HSV histogram flags *
980 *-------------------------------------------------------------------------*/
981 /*! HSV Histogram */
982 enum {
983 L_HS_HISTO = 1, /*!< Use hue-saturation histogram */
984 L_HV_HISTO = 2, /*!< Use hue-value histogram */
985 L_SV_HISTO = 3 /*!< Use saturation-value histogram */
986 };
987
988 /*-------------------------------------------------------------------------*
989 * HSV Region flags (inclusion, exclusion) *
990 *-------------------------------------------------------------------------*/
991 /*! HSV Region */
992 enum {
993 L_INCLUDE_REGION = 1, /*!< Use pixels with specified HSV region */
994 L_EXCLUDE_REGION = 2 /*!< Use pixels outside HSV region */
995 };
996
997 /*-------------------------------------------------------------------------*
998 * Location flags for adding text to a pix *
999 *-------------------------------------------------------------------------*/
1000 /*! Add Text Location */
1001 enum {
1002 L_ADD_ABOVE = 1, /*!< Add text above the image */
1003 L_ADD_BELOW = 2, /*!< Add text below the image */
1004 L_ADD_LEFT = 3, /*!< Add text to the left of the image */
1005 L_ADD_RIGHT = 4, /*!< Add text to the right of the image */
1006 L_ADD_AT_TOP = 5, /*!< Add text over the top of the image */
1007 L_ADD_AT_BOT = 6, /*!< Add text over the bottom of the image */
1008 L_ADD_AT_LEFT = 7, /*!< Add text over left side of the image */
1009 L_ADD_AT_RIGHT = 8 /*!< Add text over right side of the image */
1010 };
1011
1012 /*-------------------------------------------------------------------------*
1013 * Flags for plotting on a pix *
1014 *-------------------------------------------------------------------------*/
1015 /*! Pix Plot */
1016 enum {
1017 L_PLOT_AT_TOP = 1, /*!< Plot horizontally at top */
1018 L_PLOT_AT_MID_HORIZ = 2, /*!< Plot horizontally at middle */
1019 L_PLOT_AT_BOT = 3, /*!< Plot horizontally at bottom */
1020 L_PLOT_AT_LEFT = 4, /*!< Plot vertically at left */
1021 L_PLOT_AT_MID_VERT = 5, /*!< Plot vertically at middle */
1022 L_PLOT_AT_RIGHT = 6 /*!< Plot vertically at right */
1023 };
1024
1025 /*-------------------------------------------------------------------------*
1026 * Flags for making simple masks *
1027 *-------------------------------------------------------------------------*/
1028 /*! Mask Generation */
1029 enum {
1030 L_USE_INNER = 1, /*!< Select the interior part */
1031 L_USE_OUTER = 2 /*!< Select the outer part (e.g., a frame) */
1032 };
1033
1034 /*-------------------------------------------------------------------------*
1035 * Flags for selecting display program *
1036 *-------------------------------------------------------------------------*/
1037 /*! Display Program */
1038 enum {
1039 L_DISPLAY_WITH_NONE = 0, /*!< Disable pixDisplay() */
1040 L_DISPLAY_WITH_XZGV = 1, /*!< Use xzgv with pixDisplay() */
1041 L_DISPLAY_WITH_XLI = 2, /*!< Use xli with pixDisplay() */
1042 L_DISPLAY_WITH_XV = 3, /*!< Use xv with pixDisplay() */
1043 L_DISPLAY_WITH_IV = 4, /*!< Use irfanview (win) with pixDisplay() */
1044 L_DISPLAY_WITH_OPEN = 5 /*!< Use open (apple/win) with pixDisplay() */
1045 };
1046
1047 /*-------------------------------------------------------------------------*
1048 * Flag(s) used in the 'special' pix field for non-default operations *
1049 * - 0 is default for chroma sampling in jpeg *
1050 * - 10-19 are used for zlib compression in png write *
1051 * - 4 and 8 are used for specifying connectivity in labelling *
1052 *-------------------------------------------------------------------------*/
1053 /*! Flags used in Pix::special */
1054 enum {
1055 L_NO_CHROMA_SAMPLING_JPEG = 1 /*!< Write full resolution chroma */
1056 };
1057
1058 /*-------------------------------------------------------------------------*
1059 * Handling negative values in conversion to unsigned int *
1060 *-------------------------------------------------------------------------*/
1061 /*! Negative Value */
1062 enum {
1063 L_CLIP_TO_ZERO = 1, /*!< Clip negative values to 0 */
1064 L_TAKE_ABSVAL = 2 /*!< Convert to positive using L_ABS() */
1065 };
1066
1067 /*-------------------------------------------------------------------------*
1068 * Relative to zero flags *
1069 *-------------------------------------------------------------------------*/
1070 /*! Relative To Zero */
1071 enum {
1072 L_LESS_THAN_ZERO = 1, /*!< Choose values less than zero */
1073 L_EQUAL_TO_ZERO = 2, /*!< Choose values equal to zero */
1074 L_GREATER_THAN_ZERO = 3 /*!< Choose values greater than zero */
1075 };
1076
1077 /*-------------------------------------------------------------------------*
1078 * Flags for adding or removing trailing slash from string *
1079 *-------------------------------------------------------------------------*/
1080 /*! Trailing Slash */
1081 enum {
1082 L_ADD_TRAIL_SLASH = 1, /*!< Add trailing slash to string */
1083 L_REMOVE_TRAIL_SLASH = 2 /*!< Remove trailing slash from string */
1084 };
1085
1086 /*-------------------------------------------------------------------------*
1087 * Pix allocator and deallocator function types *
1088 *-------------------------------------------------------------------------*/
1089 /*! Allocator function type */
1090 typedef void *(*alloc_fn)(size_t);
1091
1092 /*! Deallocator function type */
1093 typedef void (*dealloc_fn)(void *);
1094
1095 #endif /* LEPTONICA_PIX_H */