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_surface {
53     cairo_surface_t base;
54 
55     /* Here final_stream corresponds to the stream/file passed to
56      * cairo_ps_surface_create surface is built. Meanwhile stream is a
57      * temporary stream in which the file output is built, (so that
58      * the header can be built and inserted into the target stream
59      * before the contents of the temporary stream are copied). */
60     cairo_output_stream_t *final_stream;
61 
62     FILE *tmpfile;
63     cairo_output_stream_t *stream;
64 
65     cairo_bool_t eps;
66     cairo_content_t content;
67     double width;
68     double height;
69     cairo_rectangle_int_t page_bbox;
70     int bbox_x1, bbox_y1, bbox_x2, bbox_y2;
71     cairo_matrix_t cairo_to_ps;
72 
73     /* XXX These 3 are used as temporary storage whilst emitting patterns */
74     cairo_image_surface_t *image;
75     cairo_image_surface_t *acquired_image;
76     void *image_extra;
77 
78     cairo_bool_t use_string_datasource;
79 
80     cairo_bool_t current_pattern_is_solid_color;
81     cairo_color_t current_color;
82 
83     int num_pages;
84 
85     cairo_paginated_mode_t paginated_mode;
86 
87     cairo_bool_t force_fallbacks;
88     cairo_bool_t has_creation_date;
89     time_t creation_date;
90 
91     cairo_scaled_font_subsets_t *font_subsets;
92 
93     cairo_list_t document_media;
94     cairo_array_t dsc_header_comments;
95     cairo_array_t dsc_setup_comments;
96     cairo_array_t dsc_page_setup_comments;
97 
98     cairo_array_t *dsc_comment_target;
99 
100     cairo_ps_level_t ps_level;
101     cairo_ps_level_t ps_level_used;
102 
103     cairo_surface_clipper_t clipper;
104 
105     cairo_pdf_operators_t pdf_operators;
106     cairo_surface_t *paginated_surface;
107 } cairo_ps_surface_t;
108 
109 #endif /* CAIRO_PS_SURFACE_PRIVATE_H */
110