1ecce36beSmrg/* Copyright © 2006 Jamey Sharp.
2ecce36beSmrg *
3ecce36beSmrg * Permission is hereby granted, free of charge, to any person obtaining a
4ecce36beSmrg * copy of this software and associated documentation files (the "Software"),
5ecce36beSmrg * to deal in the Software without restriction, including without limitation
6ecce36beSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7ecce36beSmrg * and/or sell copies of the Software, and to permit persons to whom the
8ecce36beSmrg * Software is furnished to do so, subject to the following conditions:
9ecce36beSmrg *
10ecce36beSmrg * The above copyright notice and this permission notice shall be included in
11ecce36beSmrg * all copies or substantial portions of the Software.
12ecce36beSmrg *
13ecce36beSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14ecce36beSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15ecce36beSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16ecce36beSmrg * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
17ecce36beSmrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18ecce36beSmrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19ecce36beSmrg *
20ecce36beSmrg * Except as contained in this notice, the names of the authors or their
21ecce36beSmrg * institutions shall not be used in advertising or otherwise to promote the
22ecce36beSmrg * sale, use or other dealings in this Software without prior written
23ecce36beSmrg * authorization from the authors.
24ecce36beSmrg */
25ecce36beSmrg
26ecce36beSmrg#ifndef XCB_RENDERUTIL
27ecce36beSmrg#define XCB_RENDERUTIL
28ecce36beSmrg#include <xcb/render.h>
29ecce36beSmrg
30ecce36beSmrgtypedef enum xcb_pict_format_t {
31ecce36beSmrg	XCB_PICT_FORMAT_ID         = (1 << 0),
32ecce36beSmrg	XCB_PICT_FORMAT_TYPE       = (1 << 1),
33ecce36beSmrg	XCB_PICT_FORMAT_DEPTH      = (1 << 2),
34ecce36beSmrg	XCB_PICT_FORMAT_RED        = (1 << 3),
35ecce36beSmrg	XCB_PICT_FORMAT_RED_MASK   = (1 << 4),
36ecce36beSmrg	XCB_PICT_FORMAT_GREEN      = (1 << 5),
37ecce36beSmrg	XCB_PICT_FORMAT_GREEN_MASK = (1 << 6),
38ecce36beSmrg	XCB_PICT_FORMAT_BLUE       = (1 << 7),
39ecce36beSmrg	XCB_PICT_FORMAT_BLUE_MASK  = (1 << 8),
40ecce36beSmrg	XCB_PICT_FORMAT_ALPHA      = (1 << 9),
41ecce36beSmrg	XCB_PICT_FORMAT_ALPHA_MASK = (1 << 10),
42ecce36beSmrg	XCB_PICT_FORMAT_COLORMAP   = (1 << 11)
43ecce36beSmrg} xcb_pict_format_t;
44ecce36beSmrg
45ecce36beSmrgtypedef enum xcb_pict_standard_t {
46ecce36beSmrg	XCB_PICT_STANDARD_ARGB_32,
47ecce36beSmrg	XCB_PICT_STANDARD_RGB_24,
48ecce36beSmrg	XCB_PICT_STANDARD_A_8,
49ecce36beSmrg	XCB_PICT_STANDARD_A_4,
50ecce36beSmrg	XCB_PICT_STANDARD_A_1
51ecce36beSmrg} xcb_pict_standard_t;
52ecce36beSmrg
53ecce36beSmrg
54ecce36beSmrgxcb_render_pictvisual_t *
55ecce36beSmrgxcb_render_util_find_visual_format (const xcb_render_query_pict_formats_reply_t *formats,
56ecce36beSmrg			       const xcb_visualid_t visual);
57ecce36beSmrg
58ecce36beSmrgxcb_render_pictforminfo_t *
59ecce36beSmrgxcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t	*formats,
60ecce36beSmrg			 unsigned long				mask,
61ecce36beSmrg			 const xcb_render_pictforminfo_t		*template,
62ecce36beSmrg			 int					count);
63ecce36beSmrg
64ecce36beSmrgxcb_render_pictforminfo_t *
65ecce36beSmrgxcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t	*formats,
66ecce36beSmrg				 xcb_pict_standard_t					format);
67ecce36beSmrg
68ecce36beSmrgconst xcb_render_query_version_reply_t *
69ecce36beSmrgxcb_render_util_query_version (xcb_connection_t *c);
70ecce36beSmrg
71ecce36beSmrgconst xcb_render_query_pict_formats_reply_t *
72ecce36beSmrgxcb_render_util_query_formats (xcb_connection_t *c);
73ecce36beSmrg
74ecce36beSmrgint
75ecce36beSmrgxcb_render_util_disconnect (xcb_connection_t *c);
76ecce36beSmrg
77ecce36beSmrg/* wrappers for xcb_render_composite_glyphs_8/16/32 */
78ecce36beSmrg
79ecce36beSmrgtypedef struct xcb_render_util_composite_text_stream_t xcb_render_util_composite_text_stream_t;
80ecce36beSmrg
81ecce36beSmrgxcb_render_util_composite_text_stream_t *
82ecce36beSmrgxcb_render_util_composite_text_stream (
83ecce36beSmrg	xcb_render_glyphset_t initial_glyphset,
84ecce36beSmrg	uint32_t              total_glyphs,
85ecce36beSmrg	uint32_t              total_glyphset_changes );
86ecce36beSmrg
87ecce36beSmrgvoid
88ecce36beSmrgxcb_render_util_glyphs_8 (
89ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream,
90ecce36beSmrg	int16_t  dx,
91ecce36beSmrg	int16_t  dy,
92ecce36beSmrg	uint32_t count,
93ecce36beSmrg	const uint8_t *glyphs );
94ecce36beSmrg
95ecce36beSmrgvoid
96ecce36beSmrgxcb_render_util_glyphs_16 (
97ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream,
98ecce36beSmrg	int16_t  dx,
99ecce36beSmrg	int16_t  dy,
100ecce36beSmrg	uint32_t count,
101ecce36beSmrg	const uint16_t *glyphs );
102ecce36beSmrg
103ecce36beSmrgvoid
104ecce36beSmrgxcb_render_util_glyphs_32 (
105ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream,
106ecce36beSmrg	int16_t  dx,
107ecce36beSmrg	int16_t  dy,
108ecce36beSmrg	uint32_t count,
109ecce36beSmrg	const uint32_t *glyphs );
110ecce36beSmrg
111ecce36beSmrgvoid
112ecce36beSmrgxcb_render_util_change_glyphset (
113ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream,
114ecce36beSmrg	xcb_render_glyphset_t glyphset );
115ecce36beSmrg
116ecce36beSmrgxcb_void_cookie_t
117ecce36beSmrgxcb_render_util_composite_text (
118ecce36beSmrg	xcb_connection_t        *xc,
119ecce36beSmrg	uint8_t                  op,
120ecce36beSmrg	xcb_render_picture_t     src,
121ecce36beSmrg	xcb_render_picture_t     dst,
122ecce36beSmrg	xcb_render_pictformat_t  mask_format,
123ecce36beSmrg	int16_t                  src_x,
124ecce36beSmrg	int16_t                  src_y,
125ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream );
126ecce36beSmrg
127ecce36beSmrgxcb_void_cookie_t
128ecce36beSmrgxcb_render_util_composite_text_checked (
129ecce36beSmrg	xcb_connection_t        *xc,
130ecce36beSmrg	uint8_t                  op,
131ecce36beSmrg	xcb_render_picture_t     src,
132ecce36beSmrg	xcb_render_picture_t     dst,
133ecce36beSmrg	xcb_render_pictformat_t  mask_format,
134ecce36beSmrg	int16_t                  src_x,
135ecce36beSmrg	int16_t                  src_y,
136ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream );
137ecce36beSmrg
138ecce36beSmrgvoid
139ecce36beSmrgxcb_render_util_composite_text_free (
140ecce36beSmrg	xcb_render_util_composite_text_stream_t *stream );
141ecce36beSmrg
142ecce36beSmrg#endif /* XCB_RENDERUTIL */
143