beta-0.89.2
[luatex.git] / source / libs / cairo / cairo-src / src / cairo-pdf-surface-private.h
blob618ca4ede9f9b76c54fdeb00569b71dbdb7e084a
1 /* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
2 /* cairo - a vector graphics library with display and print output
4 * Copyright © 2004 Red Hat, Inc
5 * Copyright © 2006 Red Hat, Inc
6 * Copyright © 2007, 2008 Adrian Johnson
8 * This library is free software; you can redistribute it and/or
9 * modify it either under the terms of the GNU Lesser General Public
10 * License version 2.1 as published by the Free Software Foundation
11 * (the "LGPL") or, at your option, under the terms of the Mozilla
12 * Public License Version 1.1 (the "MPL"). If you do not alter this
13 * notice, a recipient may use your version of this file under either
14 * the MPL or the LGPL.
16 * You should have received a copy of the LGPL along with this library
17 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
19 * You should have received a copy of the MPL along with this library
20 * in the file COPYING-MPL-1.1
22 * The contents of this file are subject to the Mozilla Public License
23 * Version 1.1 (the "License"); you may not use this file except in
24 * compliance with the License. You may obtain a copy of the License at
25 * http://www.mozilla.org/MPL/
27 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
28 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
29 * the specific language governing rights and limitations.
31 * The Original Code is the cairo graphics library.
33 * The Initial Developer of the Original Code is University of Southern
34 * California.
36 * Contributor(s):
37 * Kristian Høgsberg <krh@redhat.com>
38 * Carl Worth <cworth@cworth.org>
39 * Adrian Johnson <ajohnson@redneon.com>
42 #ifndef CAIRO_PDF_SURFACE_PRIVATE_H
43 #define CAIRO_PDF_SURFACE_PRIVATE_H
45 #include "cairo-pdf.h"
47 #include "cairo-surface-private.h"
48 #include "cairo-surface-clipper-private.h"
49 #include "cairo-pdf-operators-private.h"
50 #include "cairo-path-fixed-private.h"
52 typedef struct _cairo_pdf_resource {
53 unsigned int id;
54 } cairo_pdf_resource_t;
56 #define CAIRO_NUM_OPERATORS (CAIRO_OPERATOR_HSL_LUMINOSITY + 1)
58 typedef struct _cairo_pdf_group_resources {
59 cairo_bool_t operators[CAIRO_NUM_OPERATORS];
60 cairo_array_t alphas;
61 cairo_array_t smasks;
62 cairo_array_t patterns;
63 cairo_array_t shadings;
64 cairo_array_t xobjects;
65 cairo_array_t fonts;
66 } cairo_pdf_group_resources_t;
68 typedef struct _cairo_pdf_source_surface_entry {
69 cairo_hash_entry_t base;
70 unsigned int id;
71 unsigned char *unique_id;
72 unsigned long unique_id_length;
73 cairo_operator_t operator;
74 cairo_bool_t interpolate;
75 cairo_bool_t stencil_mask;
76 cairo_bool_t smask;
77 cairo_pdf_resource_t surface_res;
78 cairo_pdf_resource_t smask_res;
79 int width;
80 int height;
81 cairo_rectangle_int_t extents;
82 } cairo_pdf_source_surface_entry_t;
84 typedef struct _cairo_pdf_source_surface {
85 cairo_pattern_type_t type;
86 cairo_surface_t *surface;
87 cairo_pattern_t *raster_pattern;
88 cairo_pdf_source_surface_entry_t *hash_entry;
89 } cairo_pdf_source_surface_t;
91 typedef struct _cairo_pdf_pattern {
92 double width;
93 double height;
94 cairo_rectangle_int_t extents;
95 cairo_pattern_t *pattern;
96 cairo_pdf_resource_t pattern_res;
97 cairo_pdf_resource_t gstate_res;
98 cairo_operator_t operator;
99 cairo_bool_t is_shading;
100 } cairo_pdf_pattern_t;
102 typedef enum _cairo_pdf_operation {
103 PDF_PAINT,
104 PDF_MASK,
105 PDF_FILL,
106 PDF_STROKE,
107 PDF_SHOW_GLYPHS
108 } cairo_pdf_operation_t;
110 typedef struct _cairo_pdf_smask_group {
111 double width;
112 double height;
113 cairo_rectangle_int_t extents;
114 cairo_pdf_resource_t group_res;
115 cairo_pdf_operation_t operation;
116 cairo_pattern_t *source;
117 cairo_pdf_resource_t source_res;
118 cairo_pattern_t *mask;
119 cairo_path_fixed_t path;
120 cairo_fill_rule_t fill_rule;
121 cairo_stroke_style_t style;
122 cairo_matrix_t ctm;
123 cairo_matrix_t ctm_inverse;
124 char *utf8;
125 int utf8_len;
126 cairo_glyph_t *glyphs;
127 int num_glyphs;
128 cairo_text_cluster_t *clusters;
129 int num_clusters;
130 cairo_bool_t cluster_flags;
131 cairo_scaled_font_t *scaled_font;
132 } cairo_pdf_smask_group_t;
134 typedef struct _cairo_pdf_jbig2_global {
135 unsigned char *id;
136 unsigned long id_length;
137 cairo_pdf_resource_t res;
138 cairo_bool_t emitted;
139 } cairo_pdf_jbig2_global_t;
141 typedef struct _cairo_pdf_surface cairo_pdf_surface_t;
143 struct _cairo_pdf_surface {
144 cairo_surface_t base;
146 /* Prefer the name "output" here to avoid confusion over the
147 * structure within a PDF document known as a "stream". */
148 cairo_output_stream_t *output;
150 double width;
151 double height;
152 cairo_matrix_t cairo_to_pdf;
154 cairo_array_t objects;
155 cairo_array_t pages;
156 cairo_array_t rgb_linear_functions;
157 cairo_array_t alpha_linear_functions;
158 cairo_array_t page_patterns;
159 cairo_array_t page_surfaces;
160 cairo_hash_table_t *all_surfaces;
161 cairo_array_t smask_groups;
162 cairo_array_t knockout_group;
163 cairo_array_t jbig2_global;
165 cairo_scaled_font_subsets_t *font_subsets;
166 cairo_array_t fonts;
168 cairo_pdf_resource_t next_available_resource;
169 cairo_pdf_resource_t pages_resource;
171 cairo_pdf_version_t pdf_version;
172 cairo_bool_t compress_content;
174 cairo_pdf_resource_t content;
175 cairo_pdf_resource_t content_resources;
176 cairo_pdf_group_resources_t resources;
177 cairo_bool_t has_fallback_images;
178 cairo_bool_t header_emitted;
180 struct {
181 cairo_bool_t active;
182 cairo_pdf_resource_t self;
183 cairo_pdf_resource_t length;
184 long start_offset;
185 cairo_bool_t compressed;
186 cairo_output_stream_t *old_output;
187 } pdf_stream;
189 struct {
190 cairo_bool_t active;
191 cairo_output_stream_t *stream;
192 cairo_output_stream_t *mem_stream;
193 cairo_output_stream_t *old_output;
194 cairo_pdf_resource_t resource;
195 cairo_box_double_t bbox;
196 cairo_bool_t is_knockout;
197 } group_stream;
199 cairo_surface_clipper_t clipper;
201 cairo_pdf_operators_t pdf_operators;
202 cairo_paginated_mode_t paginated_mode;
203 cairo_bool_t select_pattern_gstate_saved;
205 cairo_bool_t force_fallbacks;
207 cairo_operator_t current_operator;
208 cairo_bool_t current_pattern_is_solid_color;
209 cairo_bool_t current_color_is_stroke;
210 double current_color_red;
211 double current_color_green;
212 double current_color_blue;
213 double current_color_alpha;
215 cairo_surface_t *paginated_surface;
218 #endif /* CAIRO_PDF_SURFACE_PRIVATE_H */