1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gdk.Pixbuf;
26 
27 private import cairo.Surface;
28 private import gdk.Window;
29 private import gdk.c.functions;
30 public  import gdk.c.types;
31 private import gdkpixbuf.Pixbuf;
32 private import gobject.ObjectG;
33 public  import gtkc.gdktypes;
34 
35 
36 /** */
37 public  import gdkpixbuf.Pixbuf;
38 
39 /**
40  */
41 
42 /**
43  * Transfers image data from a #cairo_surface_t and converts it to an RGB(A)
44  * representation inside a #GdkPixbuf. This allows you to efficiently read
45  * individual pixels from cairo surfaces. For #GdkWindows, use
46  * gdk_pixbuf_get_from_window() instead.
47  *
48  * This function will create an RGB pixbuf with 8 bits per channel.
49  * The pixbuf will contain an alpha channel if the @surface contains one.
50  *
51  * Params:
52  *     surface = surface to copy from
53  *     srcX = Source X coordinate within @surface
54  *     srcY = Source Y coordinate within @surface
55  *     width = Width in pixels of region to get
56  *     height = Height in pixels of region to get
57  *
58  * Returns: A newly-created pixbuf with a
59  *     reference count of 1, or %NULL on error
60  */
61 public Pixbuf getFromSurface(Surface surface, int srcX, int srcY, int width, int height)
62 {
63 	auto p = gdk_pixbuf_get_from_surface((surface is null) ? null : surface.getSurfaceStruct(), srcX, srcY, width, height);
64 
65 	if(p is null)
66 	{
67 		return null;
68 	}
69 
70 	return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
71 }
72 
73 /**
74  * Transfers image data from a #GdkWindow and converts it to an RGB(A)
75  * representation inside a #GdkPixbuf. In other words, copies
76  * image data from a server-side drawable to a client-side RGB(A) buffer.
77  * This allows you to efficiently read individual pixels on the client side.
78  *
79  * This function will create an RGB pixbuf with 8 bits per channel with
80  * the size specified by the @width and @height arguments scaled by the
81  * scale factor of @window. The pixbuf will contain an alpha channel if
82  * the @window contains one.
83  *
84  * If the window is off the screen, then there is no image data in the
85  * obscured/offscreen regions to be placed in the pixbuf. The contents of
86  * portions of the pixbuf corresponding to the offscreen region are undefined.
87  *
88  * If the window you’re obtaining data from is partially obscured by
89  * other windows, then the contents of the pixbuf areas corresponding
90  * to the obscured regions are undefined.
91  *
92  * If the window is not mapped (typically because it’s iconified/minimized
93  * or not on the current workspace), then %NULL will be returned.
94  *
95  * If memory can’t be allocated for the return value, %NULL will be returned
96  * instead.
97  *
98  * (In short, there are several ways this function can fail, and if it fails
99  * it returns %NULL; so check the return value.)
100  *
101  * Params:
102  *     window = Source window
103  *     srcX = Source X coordinate within @window
104  *     srcY = Source Y coordinate within @window
105  *     width = Width in pixels of region to get
106  *     height = Height in pixels of region to get
107  *
108  * Returns: A newly-created pixbuf with a
109  *     reference count of 1, or %NULL on error
110  */
111 public Pixbuf getFromWindow(Window window, int srcX, int srcY, int width, int height)
112 {
113 	auto p = gdk_pixbuf_get_from_window((window is null) ? null : window.getWindowStruct(), srcX, srcY, width, height);
114 
115 	if(p is null)
116 	{
117 		return null;
118 	}
119 
120 	return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
121 }