1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2009 Intel Corporation
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.
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
15 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
16 * You should have received a copy of the MPL along with this library
17 * in the file COPYING-MPL-1.1
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/
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.
29 * Chris Wilson <chris@chris-wilson.co.uk>
34 #include "cairo-xcb-private.h"
36 #include <xcb/xcbext.h>
39 _cairo_xcb_connection_render_create_picture (cairo_xcb_connection_t
*connection
,
40 xcb_render_picture_t picture
,
41 xcb_drawable_t drawable
,
42 xcb_render_pictformat_t format
,
46 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
47 xcb_render_create_picture (connection
->xcb_connection
, picture
, drawable
,
48 format
, value_mask
, value_list
);
52 _cairo_xcb_connection_render_change_picture (cairo_xcb_connection_t
*connection
,
53 xcb_render_picture_t picture
,
57 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
58 xcb_render_change_picture (connection
->xcb_connection
, picture
,
59 value_mask
, value_list
);
63 _cairo_xcb_connection_render_set_picture_clip_rectangles (cairo_xcb_connection_t
*connection
,
64 xcb_render_picture_t picture
,
65 int16_t clip_x_origin
,
66 int16_t clip_y_origin
,
67 uint32_t rectangles_len
,
68 xcb_rectangle_t
*rectangles
)
70 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
71 xcb_render_set_picture_clip_rectangles (connection
->xcb_connection
, picture
,
72 clip_x_origin
, clip_y_origin
,
73 rectangles_len
, rectangles
);
77 _cairo_xcb_connection_render_free_picture (cairo_xcb_connection_t
*connection
,
78 xcb_render_picture_t picture
)
80 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
81 xcb_render_free_picture (connection
->xcb_connection
, picture
);
82 _cairo_xcb_connection_put_xid (connection
, picture
);
86 _cairo_xcb_connection_render_composite (cairo_xcb_connection_t
*connection
,
88 xcb_render_picture_t src
,
89 xcb_render_picture_t mask
,
90 xcb_render_picture_t dst
,
100 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_COMPOSITE
);
101 xcb_render_composite (connection
->xcb_connection
, op
, src
, mask
, dst
,
102 src_x
, src_y
, mask_x
, mask_y
, dst_x
, dst_y
, width
, height
);
106 _cairo_xcb_connection_render_trapezoids (cairo_xcb_connection_t
*connection
,
108 xcb_render_picture_t src
,
109 xcb_render_picture_t dst
,
110 xcb_render_pictformat_t mask_format
,
114 xcb_render_trapezoid_t
*traps
)
116 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS
);
117 xcb_render_trapezoids (connection
->xcb_connection
, op
, src
, dst
,
118 mask_format
, src_x
, src_y
, traps_len
, traps
);
122 _cairo_xcb_connection_render_create_glyph_set (cairo_xcb_connection_t
*connection
,
123 xcb_render_glyphset_t id
,
124 xcb_render_pictformat_t format
)
126 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
127 xcb_render_create_glyph_set (connection
->xcb_connection
, id
, format
);
131 _cairo_xcb_connection_render_free_glyph_set (cairo_xcb_connection_t
*connection
,
132 xcb_render_glyphset_t glyphset
)
134 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
135 xcb_render_free_glyph_set (connection
->xcb_connection
, glyphset
);
136 _cairo_xcb_connection_put_xid (connection
, glyphset
);
140 _cairo_xcb_connection_render_add_glyphs (cairo_xcb_connection_t
*connection
,
141 xcb_render_glyphset_t glyphset
,
144 xcb_render_glyphinfo_t
*glyphs
,
148 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
149 xcb_render_add_glyphs (connection
->xcb_connection
, glyphset
, num_glyphs
,
150 glyphs_id
, glyphs
, data_len
, data
);
154 _cairo_xcb_connection_render_free_glyphs (cairo_xcb_connection_t
*connection
,
155 xcb_render_glyphset_t glyphset
,
157 xcb_render_glyph_t
*glyphs
)
159 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
160 xcb_render_free_glyphs (connection
->xcb_connection
, glyphset
, num_glyphs
, glyphs
);
164 _cairo_xcb_connection_render_composite_glyphs_8 (cairo_xcb_connection_t
*connection
,
166 xcb_render_picture_t src
,
167 xcb_render_picture_t dst
,
168 xcb_render_pictformat_t mask_format
,
169 xcb_render_glyphset_t glyphset
,
172 uint32_t glyphcmds_len
,
175 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
176 xcb_render_composite_glyphs_8 (connection
->xcb_connection
, op
, src
, dst
, mask_format
,
177 glyphset
, src_x
, src_y
, glyphcmds_len
, glyphcmds
);
181 _cairo_xcb_connection_render_composite_glyphs_16 (cairo_xcb_connection_t
*connection
,
183 xcb_render_picture_t src
,
184 xcb_render_picture_t dst
,
185 xcb_render_pictformat_t mask_format
,
186 xcb_render_glyphset_t glyphset
,
189 uint32_t glyphcmds_len
,
192 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
193 xcb_render_composite_glyphs_16 (connection
->xcb_connection
, op
, src
, dst
, mask_format
,
194 glyphset
, src_x
, src_y
, glyphcmds_len
, glyphcmds
);
198 _cairo_xcb_connection_render_composite_glyphs_32 (cairo_xcb_connection_t
*connection
,
200 xcb_render_picture_t src
,
201 xcb_render_picture_t dst
,
202 xcb_render_pictformat_t mask_format
,
203 xcb_render_glyphset_t glyphset
,
206 uint32_t glyphcmds_len
,
209 assert (connection
->flags
& CAIRO_XCB_HAS_RENDER
);
210 xcb_render_composite_glyphs_32 (connection
->xcb_connection
, op
, src
, dst
, mask_format
,
211 glyphset
, src_x
, src_y
, glyphcmds_len
, glyphcmds
);
215 _cairo_xcb_connection_render_fill_rectangles (cairo_xcb_connection_t
*connection
,
217 xcb_render_picture_t dst
,
218 xcb_render_color_t color
,
220 xcb_rectangle_t
*rects
)
222 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES
);
223 xcb_render_fill_rectangles (connection
->xcb_connection
, op
, dst
, color
,
228 _cairo_xcb_connection_render_set_picture_transform (cairo_xcb_connection_t
*connection
,
229 xcb_render_picture_t picture
,
230 xcb_render_transform_t
*transform
)
232 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_PICTURE_TRANSFORM
);
233 xcb_render_set_picture_transform (connection
->xcb_connection
, picture
, *transform
);
237 _cairo_xcb_connection_render_set_picture_filter (cairo_xcb_connection_t
*connection
,
238 xcb_render_picture_t picture
,
242 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_FILTERS
);
243 xcb_render_set_picture_filter (connection
->xcb_connection
, picture
,
244 filter_len
, filter
, 0, NULL
);
248 _cairo_xcb_connection_render_create_solid_fill (cairo_xcb_connection_t
*connection
,
249 xcb_render_picture_t picture
,
250 xcb_render_color_t color
)
252 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_GRADIENTS
);
253 xcb_render_create_solid_fill (connection
->xcb_connection
, picture
, color
);
257 _cairo_xcb_connection_render_create_linear_gradient (cairo_xcb_connection_t
*connection
,
258 xcb_render_picture_t picture
,
259 xcb_render_pointfix_t p1
,
260 xcb_render_pointfix_t p2
,
262 xcb_render_fixed_t
*stops
,
263 xcb_render_color_t
*colors
)
265 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_GRADIENTS
);
266 xcb_render_create_linear_gradient (connection
->xcb_connection
, picture
,
267 p1
, p2
, num_stops
, stops
, colors
);
271 _cairo_xcb_connection_render_create_radial_gradient (cairo_xcb_connection_t
*connection
,
272 xcb_render_picture_t picture
,
273 xcb_render_pointfix_t inner
,
274 xcb_render_pointfix_t outer
,
275 xcb_render_fixed_t inner_radius
,
276 xcb_render_fixed_t outer_radius
,
278 xcb_render_fixed_t
*stops
,
279 xcb_render_color_t
*colors
)
281 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_GRADIENTS
);
282 xcb_render_create_radial_gradient (connection
->xcb_connection
, picture
,
283 inner
, outer
, inner_radius
, outer_radius
,
284 num_stops
, stops
, colors
);
288 _cairo_xcb_connection_render_create_conical_gradient (cairo_xcb_connection_t
*connection
,
289 xcb_render_picture_t picture
,
290 xcb_render_pointfix_t center
,
291 xcb_render_fixed_t angle
,
293 xcb_render_fixed_t
*stops
,
294 xcb_render_color_t
*colors
)
296 assert (connection
->flags
& CAIRO_XCB_RENDER_HAS_GRADIENTS
);
297 xcb_render_create_conical_gradient (connection
->xcb_connection
, picture
,
298 center
, angle
, num_stops
, stops
, colors
);