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