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