3 #endif /* ifdef HAVE_CONFIG_H */
8 #include "ecore_x_private.h"
12 * Creates a new default graphics context associated with the given
14 * @param draw Drawable to create graphics context with. If @c 0 is
15 * given instead, the default root window is used.
16 * @param value_mask Bitmask values.
17 * @param value_list List of values. The order of values must be the
18 * same than the corresponding bitmaks.
19 * @return The new default graphics context.
22 ecore_x_gc_new(Ecore_X_Drawable draw,
23 Ecore_X_GC_Value_Mask value_mask,
24 const unsigned int *value_list)
34 draw = DefaultRootWindow(_ecore_x_disp);
36 memset(&gcv, 0, sizeof (gcv));
38 for (i = 0, idx = 0, mask = 1; i <= 22; i++, mask <<= 1)
40 switch (mask & value_mask)
42 case ECORE_X_GC_VALUE_MASK_FUNCTION:
43 gcv.function = value_list[idx];
47 case ECORE_X_GC_VALUE_MASK_PLANE_MASK:
48 gcv.plane_mask = value_list[idx];
52 case ECORE_X_GC_VALUE_MASK_FOREGROUND:
53 gcv.foreground = value_list[idx];
57 case ECORE_X_GC_VALUE_MASK_BACKGROUND:
58 gcv.background = value_list[idx];
62 case ECORE_X_GC_VALUE_MASK_LINE_WIDTH:
63 gcv.line_width = value_list[idx];
67 case ECORE_X_GC_VALUE_MASK_LINE_STYLE:
68 gcv.line_style = value_list[idx];
72 case ECORE_X_GC_VALUE_MASK_CAP_STYLE:
73 gcv.cap_style = value_list[idx];
77 case ECORE_X_GC_VALUE_MASK_JOIN_STYLE:
78 gcv.join_style = value_list[idx];
82 case ECORE_X_GC_VALUE_MASK_FILL_STYLE:
83 gcv.fill_style = value_list[idx];
87 case ECORE_X_GC_VALUE_MASK_FILL_RULE:
88 gcv.fill_rule = value_list[idx];
92 case ECORE_X_GC_VALUE_MASK_TILE:
93 gcv.tile = value_list[idx];
97 case ECORE_X_GC_VALUE_MASK_STIPPLE:
98 gcv.stipple = value_list[idx];
102 case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X:
103 gcv.ts_x_origin = value_list[idx];
107 case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y:
108 gcv.ts_y_origin = value_list[idx];
112 case ECORE_X_GC_VALUE_MASK_FONT:
113 gcv.font = value_list[idx];
117 case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE:
118 gcv.subwindow_mode = value_list[idx];
122 case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES:
123 gcv.graphics_exposures = value_list[idx];
127 case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X:
128 gcv.clip_x_origin = value_list[idx];
132 case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y:
133 gcv.clip_y_origin = value_list[idx];
137 case ECORE_X_GC_VALUE_MASK_CLIP_MASK:
138 gcv.clip_mask = value_list[idx];
142 case ECORE_X_GC_VALUE_MASK_DASH_OFFSET:
143 gcv.dash_offset = value_list[idx];
147 case ECORE_X_GC_VALUE_MASK_DASH_LIST:
148 gcv.dashes = value_list[idx];
152 case ECORE_X_GC_VALUE_MASK_ARC_MODE:
153 gcv.arc_mode = value_list[idx];
159 gc = XCreateGC(_ecore_x_disp, draw, value_mask, &gcv);
160 if (_ecore_xlib_sync) ecore_x_sync();
165 * Deletes and frees the given graphics context.
166 * @param gc The given graphics context.
169 ecore_x_gc_free(Ecore_X_GC gc)
172 XFreeGC(_ecore_x_disp, gc);
173 if (_ecore_xlib_sync) ecore_x_sync();