comparison mupdf-source/thirdparty/tesseract/src/classify/protos.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 *
3 * File: protos.h
4 * Author: Mark Seaman, SW Productivity
5 *
6 * (c) Copyright 1987, Hewlett-Packard Company.
7 ** Licensed under the Apache License, Version 2.0 (the "License");
8 ** you may not use this file except in compliance with the License.
9 ** You may obtain a copy of the License at
10 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 *
17 *****************************************************************************/
18
19 #ifndef PROTOS_H
20 #define PROTOS_H
21
22 #include "bitvec.h"
23 #include "params.h"
24 #include "unicity_table.h"
25
26 #include <tesseract/unichar.h>
27
28 namespace tesseract {
29
30 struct PROTO_STRUCT {
31 float A;
32 float B;
33 float C;
34 float X;
35 float Y;
36 float Angle;
37 float Length;
38 };
39
40 struct CLASS_STRUCT {
41 int16_t NumProtos = 0;
42 int16_t MaxNumProtos = 0;
43 int16_t NumConfigs = 0;
44 int16_t MaxNumConfigs = 0;
45 std::vector<PROTO_STRUCT> Prototypes;
46 std::vector<BIT_VECTOR> Configurations;
47 UnicityTable<int> font_set;
48 };
49 using CLASS_TYPE = CLASS_STRUCT *;
50 using CLASSES = CLASS_STRUCT *;
51
52 /*----------------------------------------------------------------------
53 M a c r o s
54 ----------------------------------------------------------------------*/
55 /**
56 * AddProtoToConfig
57 *
58 * Set a single proto bit in the specified configuration.
59 */
60
61 #define AddProtoToConfig(Pid, Config) (SET_BIT(Config, Pid))
62
63 /**
64 * ProtoIn
65 *
66 * Choose the selected prototype in this class record. Return the
67 * pointer to it (PROTO_STRUCT *).
68 */
69
70 #define ProtoIn(Class, Pid) (&(Class)->Prototypes[Pid])
71
72 /*----------------------------------------------------------------------
73 F u n c t i o n s
74 ----------------------------------------------------------------------*/
75 TESS_API
76 int AddConfigToClass(CLASS_TYPE Class);
77
78 TESS_API
79 int AddProtoToClass(CLASS_TYPE Class);
80
81 TESS_API
82 void FillABC(PROTO_STRUCT *Proto);
83
84 TESS_API
85 void FreeClass(CLASS_TYPE Class);
86
87 TESS_API
88 void FreeClassFields(CLASS_TYPE Class);
89
90 void InitPrototypes();
91
92 TESS_API
93 CLASS_TYPE NewClass(int NumProtos, int NumConfigs);
94
95 } // namespace tesseract
96
97 #endif