99112005b97f06238424411e266cb8669188f621
[framework/uifw/ecore.git] / src / lib / ecore_x / xlib / ecore_x_pixmap.c
1 #include "Ecore.h"
2 #include "ecore_x_private.h"
3 #include "Ecore_X.h"
4
5 /**
6  * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
7  *
8  * Functions that operate on pixmaps.
9  */
10
11 /**
12  * Creates a new pixmap.
13  * @param   win Window used to determine which screen of the display the
14  *              pixmap should be created on.  If 0, the default root window
15  *              is used.
16  * @param   w   Width of the new pixmap.
17  * @param   h   Height of the new pixmap.
18  * @param   dep Depth of the pixmap.  If 0, the default depth of the default
19  *              screen is used.
20  * @return  New pixmap.
21  * @ingroup Ecore_X_Pixmap_Group
22  */
23 EAPI Ecore_X_Pixmap
24 ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep)
25 {
26    if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
27    if (dep == 0) dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
28    return XCreatePixmap(_ecore_x_disp, win, w, h, dep);
29 }
30
31 /**
32  * Deletes the reference to the given pixmap.
33  *
34  * If no other clients have a reference to the given pixmap, the server
35  * will destroy it.
36  *
37  * @param   pmap The given pixmap.
38  * @ingroup Ecore_X_Pixmap_Group
39  */
40 EAPI void
41 ecore_x_pixmap_del(Ecore_X_Pixmap pmap)
42 {
43    XFreePixmap(_ecore_x_disp, pmap);
44 }
45
46 /**
47  * Pastes a rectangular area of the given pixmap onto the given drawable.
48  * @param   pmap The given pixmap.
49  * @param   dest The given drawable.
50  * @param   gc   The graphics context which governs which operation will
51  *               be used to paste the area onto the drawable.
52  * @param   sx   The X position of the area on the pixmap.
53  * @param   sy   The Y position of the area on the pixmap.
54  * @param   w    The width of the area.
55  * @param   h    The height of the area.
56  * @param   dx   The X position at which to paste the area on @p dest.
57  * @param   dy   The Y position at which to paste the area on @p dest.
58  * @ingroup Ecore_X_Pixmap_Group
59  */
60 EAPI void
61 ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, 
62                      Ecore_X_GC gc, int sx, int sy, 
63                      int w, int h, int dx, int dy)
64 {
65    XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy);
66 }
67
68 /**
69  * Retrieves the size of the given pixmap.
70  * @param   pmap The given pixmap.
71  * @param   x    Pointer to an integer in which to store the X position.
72  * @param   y    Pointer to an integer in which to store the Y position.
73  * @param   w    Pointer to an integer in which to store the width.
74  * @param   h    Pointer to an integer in which to store the height.
75  * @ingroup Ecore_X_Pixmap_Group
76  */
77 EAPI void
78 ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h)
79 {
80    if (pmap)
81       ecore_x_drawable_geometry_get(pmap, x, y, w, h);
82 }
83
84 /**
85  * Retrieves the depth of the given pixmap.
86  * @param   pmap The given pixmap.
87  * @return  The depth of the pixmap.
88  * @ingroup Ecore_X_Pixmap_Group
89  */
90 EAPI int
91 ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
92 {
93    return ecore_x_drawable_depth_get(pmap);
94 }
95