Changes.
[cairo/gpu.git] / src / cairo-pdf-surface-private.h
blob5aedcd051ee545eb3cf258b3aaf9f2a119f8aafa
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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-pdf-operators-private.h"
49 #include "cairo-path-fixed-private.h"
51 typedef struct _cairo_pdf_resource {
52 unsigned int id;
53 } cairo_pdf_resource_t;
55 typedef struct _cairo_pdf_group_resources {
56 cairo_array_t alphas;
57 cairo_array_t smasks;
58 cairo_array_t patterns;
59 cairo_array_t xobjects;
60 cairo_array_t fonts;
61 } cairo_pdf_group_resources_t;
63 typedef struct _cairo_pdf_source_surface_entry {
64 cairo_hash_entry_t base;
65 unsigned int id;
66 cairo_bool_t interpolate;
67 cairo_pdf_resource_t surface_res;
68 int width;
69 int height;
70 } cairo_pdf_source_surface_entry_t;
72 typedef struct _cairo_pdf_source_surface {
73 cairo_surface_t *surface;
74 cairo_pdf_source_surface_entry_t *hash_entry;
75 } cairo_pdf_source_surface_t;
77 typedef struct _cairo_pdf_pattern {
78 double width;
79 double height;
80 cairo_rectangle_int_t extents;
81 cairo_pattern_t *pattern;
82 cairo_pdf_resource_t pattern_res;
83 cairo_pdf_resource_t gstate_res;
84 } cairo_pdf_pattern_t;
86 typedef enum _cairo_pdf_operation {
87 PDF_PAINT,
88 PDF_MASK,
89 PDF_FILL,
90 PDF_STROKE,
91 PDF_SHOW_GLYPHS
92 } cairo_pdf_operation_t;
94 typedef struct _cairo_pdf_smask_group
96 double width;
97 double height;
98 cairo_pdf_resource_t group_res;
99 cairo_pdf_operation_t operation;
100 cairo_pattern_t *source;
101 cairo_pdf_resource_t source_res;
102 cairo_pattern_t *mask;
103 cairo_path_fixed_t path;
104 cairo_fill_rule_t fill_rule;
105 cairo_stroke_style_t *style;
106 cairo_matrix_t ctm;
107 cairo_matrix_t ctm_inverse;
108 char *utf8;
109 int utf8_len;
110 cairo_glyph_t *glyphs;
111 int num_glyphs;
112 cairo_text_cluster_t *clusters;
113 int num_clusters;
114 cairo_bool_t cluster_flags;
115 cairo_scaled_font_t *scaled_font;
116 } cairo_pdf_smask_group_t;
118 typedef struct _cairo_pdf_surface cairo_pdf_surface_t;
120 struct _cairo_pdf_surface {
121 cairo_surface_t base;
123 /* Prefer the name "output" here to avoid confusion over the
124 * structure within a PDF document known as a "stream". */
125 cairo_output_stream_t *output;
127 double width;
128 double height;
129 cairo_matrix_t cairo_to_pdf;
131 cairo_array_t objects;
132 cairo_array_t pages;
133 cairo_array_t rgb_linear_functions;
134 cairo_array_t alpha_linear_functions;
135 cairo_array_t page_patterns;
136 cairo_array_t page_surfaces;
137 cairo_hash_table_t *all_surfaces;
138 cairo_array_t smask_groups;
139 cairo_array_t knockout_group;
141 cairo_scaled_font_subsets_t *font_subsets;
142 cairo_array_t fonts;
144 cairo_pdf_resource_t next_available_resource;
145 cairo_pdf_resource_t pages_resource;
147 cairo_pdf_version_t pdf_version;
148 cairo_bool_t compress_content;
150 cairo_pdf_resource_t content;
151 cairo_pdf_resource_t content_resources;
152 cairo_pdf_group_resources_t resources;
153 cairo_bool_t has_fallback_images;
154 cairo_bool_t header_emitted;
156 struct {
157 cairo_bool_t active;
158 cairo_pdf_resource_t self;
159 cairo_pdf_resource_t length;
160 long start_offset;
161 cairo_bool_t compressed;
162 cairo_output_stream_t *old_output;
163 } pdf_stream;
165 struct {
166 cairo_bool_t active;
167 cairo_output_stream_t *stream;
168 cairo_output_stream_t *mem_stream;
169 cairo_output_stream_t *old_output;
170 cairo_pdf_resource_t resource;
171 cairo_bool_t is_knockout;
172 } group_stream;
174 cairo_pdf_operators_t pdf_operators;
175 cairo_paginated_mode_t paginated_mode;
176 cairo_bool_t select_pattern_gstate_saved;
178 cairo_bool_t force_fallbacks;
180 cairo_bool_t current_pattern_is_solid_color;
181 cairo_bool_t current_color_is_stroke;
182 double current_color_red;
183 double current_color_green;
184 double current_color_blue;
185 double current_color_alpha;
187 cairo_surface_t *paginated_surface;
190 #endif /* CAIRO_PDF_SURFACE_PRIVATE_H */