Subversion Repositories Scribus

Rev

Rev 14952 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14952 fschmid 1
/* cairo - a vector graphics library with display and print output
2
 *
3
 * Copyright © 2005 Red Hat, Inc
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it either under the terms of the GNU Lesser General Public
7
 * License version 2.1 as published by the Free Software Foundation
8
 * (the "LGPL") or, at your option, under the terms of the Mozilla
9
 * Public License Version 1.1 (the "MPL"). If you do not alter this
10
 * notice, a recipient may use your version of this file under either
11
 * the MPL or the LGPL.
12
 *
13
 * You should have received a copy of the LGPL along with this library
14
 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
18122 mrdocs 15
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14952 fschmid 16
 * You should have received a copy of the MPL along with this library
17
 * in the file COPYING-MPL-1.1
18
 *
19
 * The contents of this file are subject to the Mozilla Public License
20
 * Version 1.1 (the "License"); you may not use this file except in
21
 * compliance with the License. You may obtain a copy of the License at
22
 * http://www.mozilla.org/MPL/
23
 *
24
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25
 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
26
 * the specific language governing rights and limitations.
27
 *
28
 * The Original Code is the cairo graphics library.
29
 *
30
 * The Initial Developer of the Original Code is Red Hat, Inc.
31
 *
32
 * Contributor(s):
33
 *      Owen Taylor <otaylor@redhat.com>
34
 */
35
 
36
#ifndef CAIRO_WIN32_PRIVATE_H
37
#define CAIRO_WIN32_PRIVATE_H
38
 
39
#include "cairo-win32.h"
40
#include "cairoint.h"
41
#include "cairo-surface-clipper-private.h"
42
 
43
#ifndef SHADEBLENDCAPS
44
#define SHADEBLENDCAPS 120
45
#endif
46
#ifndef SB_NONE
47
#define SB_NONE 0
48
#endif
49
 
50
#define WIN32_FONT_LOGICAL_SCALE 32
51
 
52
typedef struct _cairo_win32_surface {
53
    cairo_surface_t base;
54
 
55
    cairo_format_t format;
56
 
57
    HDC dc;
58
 
59
    /* We create off-screen surfaces as DIBs or DDBs, based on what we created
60
     * originally*/
61
    HBITMAP bitmap;
62
    cairo_bool_t is_dib;
63
 
64
    /* Used to save the initial 1x1 monochrome bitmap for the DC to
65
     * select back into the DC before deleting the DC and our
66
     * bitmap. For Windows XP, this doesn't seem to be necessary
67
     * ... we can just delete the DC and that automatically unselects
68
     * out bitmap. But it's standard practice so apparently is needed
69
     * on some versions of Windows.
70
     */
71
    HBITMAP saved_dc_bitmap;
72
 
73
    cairo_surface_t *image;
74
 
75
    cairo_rectangle_int_t extents;
76
 
77
    /* Initial clip bits
78
     * We need these kept around so that we maintain
79
     * whatever clip was set on the original DC at creation
80
     * time when cairo is asked to reset the surface clip.
81
     */
82
    cairo_rectangle_int_t clip_rect;
83
    HRGN initial_clip_rgn;
84
    cairo_bool_t had_simple_clip;
85
    cairo_region_t *clip_region;
86
 
87
    /* For path clipping to the printing-surface */
88
    cairo_surface_clipper_t clipper;
89
 
90
    /* Surface DC flags */
91
    uint32_t flags;
92
 
93
    /* printing surface bits */
94
    cairo_paginated_mode_t paginated_mode;
95
    cairo_content_t content;
96
    cairo_bool_t path_empty;
97
    cairo_bool_t has_ctm;
98
    cairo_matrix_t ctm;
99
    HBRUSH brush, old_brush;
100
    cairo_scaled_font_subsets_t *font_subsets;
101
} cairo_win32_surface_t;
102
 
103
/* Surface DC flag values */
104
enum {
105
    /* If this is a surface created for printing or not */
106
    CAIRO_WIN32_SURFACE_FOR_PRINTING = (1<<0),
107
 
108
    /* Whether the DC is a display DC or not */
109
    CAIRO_WIN32_SURFACE_IS_DISPLAY = (1<<1),
110
 
111
    /* Whether we can use BitBlt with this surface */
112
    CAIRO_WIN32_SURFACE_CAN_BITBLT = (1<<2),
113
 
114
    /* Whether we can use AlphaBlend with this surface */
115
    CAIRO_WIN32_SURFACE_CAN_ALPHABLEND = (1<<3),
116
 
117
    /* Whether we can use StretchBlt with this surface */
118
    CAIRO_WIN32_SURFACE_CAN_STRETCHBLT = (1<<4),
119
 
120
    /* Whether we can use StretchDIBits with this surface */
121
    CAIRO_WIN32_SURFACE_CAN_STRETCHDIB = (1<<5),
122
 
123
    /* Whether we can use GradientFill rectangles with this surface */
124
    CAIRO_WIN32_SURFACE_CAN_RECT_GRADIENT = (1<<6),
125
 
126
    /* Whether we can use the CHECKJPEGFORMAT escape function */
127
    CAIRO_WIN32_SURFACE_CAN_CHECK_JPEG = (1<<7),
128
 
129
    /* Whether we can use the CHECKJPEGFORMAT escape function */
130
    CAIRO_WIN32_SURFACE_CAN_CHECK_PNG = (1<<8),
131
};
132
 
133
cairo_status_t
134
_cairo_win32_print_gdi_error (const char *context);
135
 
136
cairo_bool_t
137
_cairo_surface_is_win32 (cairo_surface_t *surface);
138
 
139
cairo_bool_t
140
_cairo_surface_is_win32_printing (cairo_surface_t *surface);
141
 
142
cairo_status_t
143
_cairo_win32_surface_finish (void *abstract_surface);
144
 
145
cairo_bool_t
146
_cairo_win32_surface_get_extents (void                    *abstract_surface,
147
                                  cairo_rectangle_int_t   *rectangle);
148
 
149
uint32_t
150
_cairo_win32_flags_for_dc (HDC dc);
151
 
152
cairo_status_t
153
_cairo_win32_surface_set_clip_region (void           *abstract_surface,
154
                                      cairo_region_t *region);
155
 
156
cairo_int_status_t
157
_cairo_win32_surface_show_glyphs (void                  *surface,
158
                                  cairo_operator_t       op,
159
                                  const cairo_pattern_t *source,
160
                                  cairo_glyph_t         *glyphs,
161
                                  int                    num_glyphs,
162
                                  cairo_scaled_font_t   *scaled_font,
163
                                  cairo_clip_t          *clip,
164
                                  int                   *remaining_glyphs);
165
 
166
cairo_surface_t *
167
_cairo_win32_surface_create_similar (void           *abstract_src,
168
                                     cairo_content_t content,
169
                                     int             width,
170
                                     int             height);
171
 
172
cairo_status_t
173
_cairo_win32_surface_clone_similar (void *abstract_surface,
174
                                    cairo_surface_t *src,
175
                                    cairo_content_t content,
176
                                    int src_x,
177
                                    int src_y,
178
                                    int width,
179
                                    int height,
180
                                    int *clone_offset_x,
181
                                    int *clone_offset_y,
182
                                    cairo_surface_t **clone_out);
183
 
184
static inline void
185
_cairo_matrix_to_win32_xform (const cairo_matrix_t *m,
186
                              XFORM *xform)
187
{
188
    xform->eM11 = (FLOAT) m->xx;
189
    xform->eM21 = (FLOAT) m->xy;
190
    xform->eM12 = (FLOAT) m->yx;
191
    xform->eM22 = (FLOAT) m->yy;
192
    xform->eDx = (FLOAT) m->x0;
193
    xform->eDy = (FLOAT) m->y0;
194
}
195
 
196
cairo_int_status_t
197
_cairo_win32_save_initial_clip (HDC dc, cairo_win32_surface_t *surface);
198
 
199
cairo_int_status_t
200
_cairo_win32_restore_initial_clip (cairo_win32_surface_t *surface);
201
 
202
void
203
_cairo_win32_debug_dump_hrgn (HRGN rgn, char *header);
204
 
205
cairo_bool_t
206
_cairo_win32_scaled_font_is_type1 (cairo_scaled_font_t *scaled_font);
207
 
208
cairo_bool_t
209
_cairo_win32_scaled_font_is_bitmap (cairo_scaled_font_t *scaled_font);
210
 
211
#endif /* CAIRO_WIN32_PRIVATE_H */