beta-0.89.2
[luatex.git] / source / libs / cairo / cairo-src / src / cairo-xcb-connection-render.c
blob61119653e9a4385acb4c2193e91074fab3bd42a8
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.
28 * Contributor(s):
29 * Chris Wilson <chris@chris-wilson.co.uk>
32 #include "cairoint.h"
34 #include "cairo-xcb-private.h"
36 #include <xcb/xcbext.h>
38 void
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,
43 uint32_t value_mask,
44 uint32_t *value_list)
46 assert (connection->flags & CAIRO_XCB_HAS_RENDER);
47 xcb_render_create_picture (connection->xcb_connection, picture, drawable,
48 format, value_mask, value_list);
51 void
52 _cairo_xcb_connection_render_change_picture (cairo_xcb_connection_t *connection,
53 xcb_render_picture_t picture,
54 uint32_t value_mask,
55 uint32_t *value_list)
57 assert (connection->flags & CAIRO_XCB_HAS_RENDER);
58 xcb_render_change_picture (connection->xcb_connection, picture,
59 value_mask, value_list);
62 void
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);
76 void
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);
85 void
86 _cairo_xcb_connection_render_composite (cairo_xcb_connection_t *connection,
87 uint8_t op,
88 xcb_render_picture_t src,
89 xcb_render_picture_t mask,
90 xcb_render_picture_t dst,
91 int16_t src_x,
92 int16_t src_y,
93 int16_t mask_x,
94 int16_t mask_y,
95 int16_t dst_x,
96 int16_t dst_y,
97 uint16_t width,
98 uint16_t height)
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);
105 void
106 _cairo_xcb_connection_render_trapezoids (cairo_xcb_connection_t *connection,
107 uint8_t op,
108 xcb_render_picture_t src,
109 xcb_render_picture_t dst,
110 xcb_render_pictformat_t mask_format,
111 int16_t src_x,
112 int16_t src_y,
113 uint32_t traps_len,
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);
121 void
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);
130 void
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);
139 void
140 _cairo_xcb_connection_render_add_glyphs (cairo_xcb_connection_t *connection,
141 xcb_render_glyphset_t glyphset,
142 uint32_t num_glyphs,
143 uint32_t *glyphs_id,
144 xcb_render_glyphinfo_t *glyphs,
145 uint32_t data_len,
146 uint8_t *data)
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);
153 void
154 _cairo_xcb_connection_render_free_glyphs (cairo_xcb_connection_t *connection,
155 xcb_render_glyphset_t glyphset,
156 uint32_t num_glyphs,
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);
163 void
164 _cairo_xcb_connection_render_composite_glyphs_8 (cairo_xcb_connection_t *connection,
165 uint8_t op,
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,
170 int16_t src_x,
171 int16_t src_y,
172 uint32_t glyphcmds_len,
173 uint8_t *glyphcmds)
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);
180 void
181 _cairo_xcb_connection_render_composite_glyphs_16 (cairo_xcb_connection_t *connection,
182 uint8_t op,
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,
187 int16_t src_x,
188 int16_t src_y,
189 uint32_t glyphcmds_len,
190 uint8_t *glyphcmds)
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);
197 void
198 _cairo_xcb_connection_render_composite_glyphs_32 (cairo_xcb_connection_t *connection,
199 uint8_t op,
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,
204 int16_t src_x,
205 int16_t src_y,
206 uint32_t glyphcmds_len,
207 uint8_t *glyphcmds)
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);
214 void
215 _cairo_xcb_connection_render_fill_rectangles (cairo_xcb_connection_t *connection,
216 uint8_t op,
217 xcb_render_picture_t dst,
218 xcb_render_color_t color,
219 uint32_t num_rects,
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,
224 num_rects, rects);
227 void
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);
236 void
237 _cairo_xcb_connection_render_set_picture_filter (cairo_xcb_connection_t *connection,
238 xcb_render_picture_t picture,
239 uint16_t filter_len,
240 char *filter)
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);
247 void
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);
256 void
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,
261 uint32_t num_stops,
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);
270 void
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,
277 uint32_t num_stops,
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);
287 void
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,
292 uint32_t num_stops,
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);