1 /* Copyright (C) 2001-2020 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 /*
17     jbig2dec
18 */
19 
20 #ifndef _JBIG2_HALFTONE_H
21 #define _JBIG2_HALFTONE_H
22 
23 typedef struct {
24     int n_patterns;
25     Jbig2Image **patterns;
26     uint32_t HPW, HPH;
27 } Jbig2PatternDict;
28 
29 /* Table 24 */
30 typedef struct {
31     bool HDMMR;
32     uint32_t HDPW;
33     uint32_t HDPH;
34     uint32_t GRAYMAX;
35     int HDTEMPLATE;
36 } Jbig2PatternDictParams;
37 
38 /* Table 33 */
39 typedef struct {
40     byte flags;
41     uint32_t HGW;
42     uint32_t HGH;
43     int32_t HGX;
44     int32_t HGY;
45     uint16_t HRX;
46     uint16_t HRY;
47     bool HMMR;
48     int HTEMPLATE;
49     bool HENABLESKIP;
50     Jbig2ComposeOp HCOMBOP;
51     bool HDEFPIXEL;
52 } Jbig2HalftoneRegionParams;
53 
54 void jbig2_hd_release(Jbig2Ctx *ctx, Jbig2PatternDict *dict);
55 
56 int jbig2_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data);
57 int jbig2_pattern_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data);
58 
59 #endif /* _JBIG2_HALFTONE_H */
60