Tizen 2.1 base
[framework/uifw/ecore.git] / src / lib / ecore_x / xcb / ecore_xcb_pixmap.c
1 #include "ecore_xcb_private.h"
2
3 /**
4  * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
5  *
6  * Functions that operate on pixmaps.
7  */
8
9 /**
10  * Creates a new pixmap.
11  * @param   win Window used to determine which screen of the display the
12  *              pixmap should be created on.  If 0, the default root window
13  *              is used.
14  * @param   w   Width of the new pixmap.
15  * @param   h   Height of the new pixmap.
16  * @param   dep Depth of the pixmap.  If 0, the default depth of the default
17  *              screen is used.
18  * @return  New pixmap.
19  * @ingroup Ecore_X_Pixmap_Group
20  */
21 EAPI Ecore_X_Pixmap
22 ecore_x_pixmap_new(Ecore_X_Window win,
23                    int            w,
24                    int            h,
25                    int            dep)
26 {
27    Ecore_X_Pixmap pmap;
28
29    LOGFN(__FILE__, __LINE__, __FUNCTION__);
30    CHECK_XCB_CONN;
31
32    if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
33    if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
34
35    pmap = xcb_generate_id(_ecore_xcb_conn);
36    xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
37
38 //   ecore_x_flush();
39    return pmap;
40 }
41
42 /**
43  * Deletes the reference to the given pixmap.
44  *
45  * If no other clients have a reference to the given pixmap, the server
46  * will destroy it.
47  *
48  * @param   pmap The given pixmap.
49  * @ingroup Ecore_X_Pixmap_Group
50  */
51 EAPI void
52 ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
53 {
54    LOGFN(__FILE__, __LINE__, __FUNCTION__);
55    CHECK_XCB_CONN;
56
57    xcb_free_pixmap(_ecore_xcb_conn, pmap);
58 //   ecore_x_flush();
59 }
60
61 /**
62  * Pastes a rectangular area of the given pixmap onto the given drawable.
63  * @param   pmap The given pixmap.
64  * @param   dest The given drawable.
65  * @param   gc   The graphics context which governs which operation will
66  *               be used to paste the area onto the drawable.
67  * @param   sx   The X position of the area on the pixmap.
68  * @param   sy   The Y position of the area on the pixmap.
69  * @param   w    The width of the area.
70  * @param   h    The height of the area.
71  * @param   dx   The X position at which to paste the area on @p dest.
72  * @param   dy   The Y position at which to paste the area on @p dest.
73  * @ingroup Ecore_X_Pixmap_Group
74  */
75 EAPI void
76 ecore_x_pixmap_paste(Ecore_X_Pixmap   pmap,
77                      Ecore_X_Drawable dest,
78                      Ecore_X_GC       gc,
79                      int              sx,
80                      int              sy,
81                      int              w,
82                      int              h,
83                      int              dx,
84                      int              dy)
85 {
86    LOGFN(__FILE__, __LINE__, __FUNCTION__);
87    CHECK_XCB_CONN;
88
89    xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
90 //   ecore_x_flush();
91 }
92
93 /**
94  * Retrieves the size of the given pixmap.
95  * @param   pmap The given pixmap.
96  * @param   x    Pointer to an integer in which to store the X position.
97  * @param   y    Pointer to an integer in which to store the Y position.
98  * @param   w    Pointer to an integer in which to store the width.
99  * @param   h    Pointer to an integer in which to store the height.
100  * @ingroup Ecore_X_Pixmap_Group
101  */
102 EAPI void
103 ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
104                             int           *x,
105                             int           *y,
106                             int           *w,
107                             int           *h)
108 {
109    LOGFN(__FILE__, __LINE__, __FUNCTION__);
110
111    if (pmap)
112      ecore_x_drawable_geometry_get(pmap, x, y, w, h);
113 }
114
115 /**
116  * Retrieves the depth of the given pixmap.
117  * @param   pmap The given pixmap.
118  * @return  The depth of the pixmap.
119  * @ingroup Ecore_X_Pixmap_Group
120  */
121 EAPI int
122 ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
123 {
124    LOGFN(__FILE__, __LINE__, __FUNCTION__);
125
126    return ecore_x_drawable_depth_get(pmap);
127 }
128