comparison mupdf-source/thirdparty/leptonica/src/ccbord_internal.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_CCBORD_INTERNAL_H
28 #define LEPTONICA_CCBORD_INTERNAL_H
29
30 /*!
31 * \file ccbord_internal.h
32 *
33 * <pre>
34 *
35 * This file is internal; it is not part of the public interface.
36 * It contains definitions of data structures that use border pixels
37 * of connected components to represent the foreground pixels
38 * in an image by the border
39 *
40 * CCBord: represents a single connected component
41 * CCBorda: an array of CCBord
42 *
43 * The CCBord contains:
44 *
45 * (1) a minimally-clipped bitmap of the component (pix),
46 * (2) a boxa consisting of:
47 * for the primary component:
48 * (xul, yul) pixel location in global coords
49 * (w, h) of the bitmap
50 * for the hole components:
51 * (x, y) in relative coordinates in primary component
52 * (w, h) of the hole border (which is 2 pixels
53 * larger in each direction than the hole itself)
54 * (3) a pta ('start') of the initial border pixel location for each
55 * closed curve, all in relative coordinates of the primary
56 * component. This is given for the primary component,
57 * followed by the hole components, if any.
58 * (4) a refcount of the ccbord; used internally when a ccbord
59 * is accessed from a ccborda (array of ccbord)
60 * (5) a ptaa for the chain code for the border in relative
61 * coordinates, where the first pta is the exterior border
62 * and all other pta are for interior borders (holes)
63 * (6) a ptaa for the global pixel loc rendition of the border,
64 * where the first pta is the exterior border and all other
65 * pta are for interior borders (holes).
66 * This is derived from the local or step chain code.
67 * (7) a numaa for the chain code for the border as orientation
68 * directions between successive border pixels, where
69 * the first numa is the exterior border and all other
70 * numa are for interior borders (holes). This is derived
71 * from the local chain code. The 8 directions are 0 - 7.
72 * (8) a pta for a single chain for each c.c., comprised of outer
73 * and hole borders, plus cut paths between them, all in
74 * local coords.
75 * (9) a pta for a single chain for each c.c., comprised of outer
76 * and hole borders, plus cut paths between them, all in
77 * global coords.
78 * </pre>
79 */
80
81 /*! A single CCBord for a connected component */
82 struct CCBord
83 {
84 struct Pix *pix; /*!< component bitmap (min size) */
85 struct Boxa *boxa; /*!< regions of each closed curve */
86 struct Pta *start; /*!< initial border pixel locations */
87 l_atomic refcount; /*!< number of handles; start at 1 */
88 struct Ptaa *local; /*!< ptaa of chain pixels (local) */
89 struct Ptaa *global; /*!< ptaa of chain pixels (global) */
90 struct Numaa *step; /*!< numaa of chain code (step dir) */
91 struct Pta *splocal; /*!< pta of single chain (local) */
92 struct Pta *spglobal; /*!< pta of single chain (global) */
93 };
94
95 /*! Array of CCBord */
96 struct CCBorda
97 {
98 struct Pix *pix; /*!< input pix (may be null) */
99 l_int32 w; /*!< width of pix */
100 l_int32 h; /*!< height of pix */
101 l_int32 n; /*!< number of ccbord in ptr array */
102 l_int32 nalloc; /*!< number of ccbord ptrs allocated */
103 struct CCBord **ccb; /*!< ccb ptr array */
104 };
105
106 #endif /* LEPTONICA_CCBORD_INTERNAL_H */
107