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_PAGE_H
21 #define _JBIG2_PAGE_H
22 
23 /* the page structure handles decoded page
24    results. it's allocated by a 'page info'
25    segment and marked complete by an 'end of page'
26    segment.
27 */
28 typedef enum {
29     JBIG2_PAGE_FREE,
30     JBIG2_PAGE_NEW,
31     JBIG2_PAGE_COMPLETE,
32     JBIG2_PAGE_RETURNED,
33     JBIG2_PAGE_RELEASED
34 } Jbig2PageState;
35 
36 struct _Jbig2Page {
37     Jbig2PageState state;
38     uint32_t number;
39     uint32_t height, width;     /* in pixels */
40     uint32_t x_resolution, y_resolution;        /* in pixels per meter */
41     uint16_t stripe_size;
42     bool striped;
43     uint32_t end_row;
44     uint8_t flags;
45     Jbig2Image *image;
46 };
47 
48 int jbig2_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
49 int jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
50 int jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
51 int jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *src, uint32_t x, uint32_t y, Jbig2ComposeOp op);
52 
53 #endif /* _JBIG2_PAGE_H */
54