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
3  *
4  * Copyright © 2003 University of Southern California
5  * Copyright © 2005 Red Hat, Inc
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it either under the terms of the GNU Lesser General Public
9  * License version 2.1 as published by the Free Software Foundation
10  * (the "LGPL") or, at your option, under the terms of the Mozilla
11  * Public License Version 1.1 (the "MPL"). If you do not alter this
12  * notice, a recipient may use your version of this file under either
13  * the MPL or the LGPL.
14  *
15  * You should have received a copy of the LGPL along with this library
16  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
18  * You should have received a copy of the MPL along with this library
19  * in the file COPYING-MPL-1.1
20  *
21  * The contents of this file are subject to the Mozilla Public License
22  * Version 1.1 (the "License"); you may not use this file except in
23  * compliance with the License. You may obtain a copy of the License at
24  * http://www.mozilla.org/MPL/
25  *
26  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
27  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
28  * the specific language governing rights and limitations.
29  *
30  * The Original Code is the cairo graphics library.
31  *
32  * The Initial Developer of the Original Code is University of Southern
33  * California.
34  *
35  * Contributor(s):
36  *	Carl D. Worth <cworth@cworth.org>
37  *	Kristian Høgsberg <krh@redhat.com>
38  *	Keith Packard <keithp@keithp.com>
39  */
40 
41 #ifndef CAIRO_PS_SURFACE_PRIVATE_H
42 #define CAIRO_PS_SURFACE_PRIVATE_H
43 
44 #include "cairo-ps.h"
45 
46 #include "cairo-surface-private.h"
47 #include "cairo-surface-clipper-private.h"
48 #include "cairo-pdf-operators-private.h"
49 
50 #include <time.h>
51 
52 typedef struct _cairo_ps_form {
53     cairo_hash_entry_t base;
54     unsigned char *unique_id;
55     unsigned long unique_id_length;
56     cairo_bool_t is_image;
57     int id;
58     cairo_surface_t *src_surface;
59     cairo_rectangle_int_t src_surface_extents;
60     cairo_bool_t src_surface_bounded;
61     cairo_filter_t filter;
62 
63     /* Union of source extents required for all operations using this form */
64     cairo_rectangle_int_t required_extents;
65 } cairo_ps_form_t;
66 
67 typedef struct cairo_ps_surface {
68     cairo_surface_t base;
69 
70     /* Here final_stream corresponds to the stream/file passed to
71      * cairo_ps_surface_create surface is built. Meanwhile stream is a
72      * temporary stream in which the file output is built, (so that
73      * the header can be built and inserted into the target stream
74      * before the contents of the temporary stream are copied). */
75     cairo_output_stream_t *final_stream;
76 
77     FILE *tmpfile;
78     cairo_output_stream_t *stream;
79 
80     cairo_bool_t eps;
81     cairo_bool_t contains_eps;
82     cairo_content_t content;
83     double width;
84     double height;
85     cairo_point_int_t document_bbox_p1, document_bbox_p2; /* in PS coordinates */
86     cairo_rectangle_int_t surface_extents;
87     cairo_bool_t surface_bounded;
88     cairo_matrix_t cairo_to_ps;
89     cairo_bool_t paint_proc; /* TRUE if surface will be used in a PaintProc */
90 
91     cairo_bool_t current_pattern_is_solid_color;
92     cairo_color_t current_color;
93 
94     int num_pages;
95 
96     cairo_paginated_mode_t paginated_mode;
97 
98     cairo_bool_t force_fallbacks;
99     cairo_bool_t has_creation_date;
100     time_t creation_date;
101 
102     cairo_scaled_font_subsets_t *font_subsets;
103 
104     cairo_list_t document_media;
105     cairo_array_t dsc_header_comments;
106     cairo_array_t dsc_setup_comments;
107     cairo_array_t dsc_page_setup_comments;
108 
109     cairo_array_t recording_surf_stack;
110 
111     cairo_array_t *dsc_comment_target;
112 
113     cairo_ps_level_t ps_level;
114     cairo_ps_level_t ps_level_used;
115 
116     cairo_surface_clipper_t clipper;
117 
118     cairo_pdf_operators_t pdf_operators;
119     cairo_surface_t *paginated_surface;
120     cairo_hash_table_t *forms;
121     int num_forms;
122     long total_form_size;
123 } cairo_ps_surface_t;
124 
125 #endif /* CAIRO_PS_SURFACE_PRIVATE_H */
126