| 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 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | typedef enum xcb_pict_format_t { |
| 35 | XCB_PICT_FORMAT_ID = (1 << 0), |
| 36 | XCB_PICT_FORMAT_TYPE = (1 << 1), |
| 37 | XCB_PICT_FORMAT_DEPTH = (1 << 2), |
| 38 | XCB_PICT_FORMAT_RED = (1 << 3), |
| 39 | XCB_PICT_FORMAT_RED_MASK = (1 << 4), |
| 40 | XCB_PICT_FORMAT_GREEN = (1 << 5), |
| 41 | XCB_PICT_FORMAT_GREEN_MASK = (1 << 6), |
| 42 | XCB_PICT_FORMAT_BLUE = (1 << 7), |
| 43 | XCB_PICT_FORMAT_BLUE_MASK = (1 << 8), |
| 44 | XCB_PICT_FORMAT_ALPHA = (1 << 9), |
| 45 | XCB_PICT_FORMAT_ALPHA_MASK = (1 << 10), |
| 46 | XCB_PICT_FORMAT_COLORMAP = (1 << 11) |
| 47 | } xcb_pict_format_t; |
| 48 | |
| 49 | typedef enum xcb_pict_standard_t { |
| 50 | XCB_PICT_STANDARD_ARGB_32, |
| 51 | XCB_PICT_STANDARD_RGB_24, |
| 52 | XCB_PICT_STANDARD_A_8, |
| 53 | XCB_PICT_STANDARD_A_4, |
| 54 | XCB_PICT_STANDARD_A_1 |
| 55 | } xcb_pict_standard_t; |
| 56 | |
| 57 | |
| 58 | xcb_render_pictvisual_t * |
| 59 | xcb_render_util_find_visual_format (const xcb_render_query_pict_formats_reply_t *formats, |
| 60 | const xcb_visualid_t visual); |
| 61 | |
| 62 | xcb_render_pictforminfo_t * |
| 63 | xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t *formats, |
| 64 | unsigned long mask, |
| 65 | const xcb_render_pictforminfo_t *ptemplate, |
| 66 | int count); |
| 67 | |
| 68 | xcb_render_pictforminfo_t * |
| 69 | xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t *formats, |
| 70 | xcb_pict_standard_t format); |
| 71 | |
| 72 | const xcb_render_query_version_reply_t * |
| 73 | xcb_render_util_query_version (xcb_connection_t *c); |
| 74 | |
| 75 | const xcb_render_query_pict_formats_reply_t * |
| 76 | xcb_render_util_query_formats (xcb_connection_t *c); |
| 77 | |
| 78 | int |
| 79 | xcb_render_util_disconnect (xcb_connection_t *c); |
| 80 | |
| 81 | /* wrappers for xcb_render_composite_glyphs_8/16/32 */ |
| 82 | |
| 83 | typedef struct xcb_render_util_composite_text_stream_t xcb_render_util_composite_text_stream_t; |
| 84 | |
| 85 | xcb_render_util_composite_text_stream_t * |
| 86 | xcb_render_util_composite_text_stream ( |
| 87 | xcb_render_glyphset_t initial_glyphset, |
| 88 | uint32_t total_glyphs, |
| 89 | uint32_t total_glyphset_changes ); |
| 90 | |
| 91 | void |
| 92 | xcb_render_util_glyphs_8 ( |
| 93 | xcb_render_util_composite_text_stream_t *stream, |
| 94 | int16_t dx, |
| 95 | int16_t dy, |
| 96 | uint32_t count, |
| 97 | const uint8_t *glyphs ); |
| 98 | |
| 99 | void |
| 100 | xcb_render_util_glyphs_16 ( |
| 101 | xcb_render_util_composite_text_stream_t *stream, |
| 102 | int16_t dx, |
| 103 | int16_t dy, |
| 104 | uint32_t count, |
| 105 | const uint16_t *glyphs ); |
| 106 | |
| 107 | void |
| 108 | xcb_render_util_glyphs_32 ( |
| 109 | xcb_render_util_composite_text_stream_t *stream, |
| 110 | int16_t dx, |
| 111 | int16_t dy, |
| 112 | uint32_t count, |
| 113 | const uint32_t *glyphs ); |
| 114 | |
| 115 | void |
| 116 | xcb_render_util_change_glyphset ( |
| 117 | xcb_render_util_composite_text_stream_t *stream, |
| 118 | xcb_render_glyphset_t glyphset ); |
| 119 | |
| 120 | xcb_void_cookie_t |
| 121 | xcb_render_util_composite_text ( |
| 122 | xcb_connection_t *xc, |
| 123 | uint8_t op, |
| 124 | xcb_render_picture_t src, |
| 125 | xcb_render_picture_t dst, |
| 126 | xcb_render_pictformat_t mask_format, |
| 127 | int16_t src_x, |
| 128 | int16_t src_y, |
| 129 | xcb_render_util_composite_text_stream_t *stream ); |
| 130 | |
| 131 | xcb_void_cookie_t |
| 132 | xcb_render_util_composite_text_checked ( |
| 133 | xcb_connection_t *xc, |
| 134 | uint8_t op, |
| 135 | xcb_render_picture_t src, |
| 136 | xcb_render_picture_t dst, |
| 137 | xcb_render_pictformat_t mask_format, |
| 138 | int16_t src_x, |
| 139 | int16_t src_y, |
| 140 | xcb_render_util_composite_text_stream_t *stream ); |
| 141 | |
| 142 | void |
| 143 | xcb_render_util_composite_text_free ( |
| 144 | xcb_render_util_composite_text_stream_t *stream ); |
| 145 | |
| 146 | #ifdef __cplusplus |
| 147 | } |
| 148 | #endif |
| 149 | |
| 150 | #endif /* XCB_RENDERUTIL */ |
| 151 | |