svn update: 48958 (latest:48959)
[framework/uifw/ecore.git] / src / lib / ecore_x / xcb / ecore_xcb_gc.c
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #include "ecore_xcb_private.h"
6
7
8 /**
9  * Creates a new default graphics context associated with the given
10  * drawable.
11  * @param  drawable Drawable to create graphics context with.  If @c 0 is
12  *                  given instead, the default root window is used.
13  * @param value_mask Bitmask values.
14  * @param value_list List of values. The order of values must be the
15  *                   same than the corresponding bitmaks.
16  * @return          The new default graphics context.
17  *
18  * Creates a new default graphics context associated with @p
19  * drawable. The graphic context can be used with any destination
20  * drawable having the same root and depth as @p drawable. Use with
21  * other drawables results in a BadMatch error.
22  */
23 EAPI Ecore_X_GC
24 ecore_x_gc_new(Ecore_X_Drawable drawable, Ecore_X_GC_Value_Mask value_mask, const unsigned int *value_list)
25 {
26    xcb_gcontext_t gc;
27
28    if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
29
30    gc = xcb_generate_id(_ecore_xcb_conn);
31    xcb_create_gc(_ecore_xcb_conn, gc, drawable, value_mask, value_list);
32
33    return gc;
34 }
35
36
37 /**
38  * Deletes and frees the given graphics context.
39  * @param gc The given graphics context.
40  *
41  * Destroyes the graphic context @p gc as well as the associated
42  * storage.
43  */
44 EAPI void
45 ecore_x_gc_free(Ecore_X_GC gc)
46 {
47    xcb_free_gc(_ecore_xcb_conn, gc);
48 }