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