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 gdkpixbuf.Pixbuf;
30 private import gobject.ObjectG;
31 private import gtkc.gdk;
32 public  import gtkc.gdktypes;
33 
34 
35 /** */
36 public  import gdkpixbuf.Pixbuf;
37 
38 /**
39  */
40 
41 /**
42  * Transfers image data from a #cairo_surface_t and converts it to an RGB(A)
43  * representation inside a #GdkPixbuf. This allows you to efficiently read
44  * individual pixels from cairo surfaces. For #GdkWindows, use
45  * gdk_pixbuf_get_from_window() instead.
46  *
47  * This function will create an RGB pixbuf with 8 bits per channel.
48  * The pixbuf will contain an alpha channel if the @surface contains one.
49  *
50  * Params:
51  *     surface = surface to copy from
52  *     srcX = Source X coordinate within @surface
53  *     srcY = Source Y coordinate within @surface
54  *     width = Width in pixels of region to get
55  *     height = Height in pixels of region to get
56  *
57  * Return: A newly-created pixbuf with a
58  *     reference count of 1, or %NULL on error
59  */
60 public Pixbuf getFromSurface(Surface surface, int srcX, int srcY, int width, int height)
61 {
62 	auto p = gdk_pixbuf_get_from_surface((surface is null) ? null : surface.getSurfaceStruct(), srcX, srcY, width, height);
63 	
64 	if(p is null)
65 	{
66 		return null;
67 	}
68 	
69 	return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
70 }
71 
72 /**
73  * Transfers image data from a #GdkWindow and converts it to an RGB(A)
74  * representation inside a #GdkPixbuf. In other words, copies
75  * image data from a server-side drawable to a client-side RGB(A) buffer.
76  * This allows you to efficiently read individual pixels on the client side.
77  *
78  * This function will create an RGB pixbuf with 8 bits per channel with
79  * the same size specified by the @width and @height arguments. The pixbuf
80  * will contain an alpha channel if the @window contains one.
81  *
82  * If the window is off the screen, then there is no image data in the
83  * obscured/offscreen regions to be placed in the pixbuf. The contents of
84  * portions of the pixbuf corresponding to the offscreen region are undefined.
85  *
86  * If the window you’re obtaining data from is partially obscured by
87  * other windows, then the contents of the pixbuf areas corresponding
88  * to the obscured regions are undefined.
89  *
90  * If the window is not mapped (typically because it’s iconified/minimized
91  * or not on the current workspace), then %NULL will be returned.
92  *
93  * If memory can’t be allocated for the return value, %NULL will be returned
94  * instead.
95  *
96  * (In short, there are several ways this function can fail, and if it fails
97  * it returns %NULL; so check the return value.)
98  *
99  * Params:
100  *     window = Source window
101  *     srcX = Source X coordinate within @window
102  *     srcY = Source Y coordinate within @window
103  *     width = Width in logical pixels of region to get
104  *     height = Height in logical pixels of region to get
105  *
106  * Return: A newly-created pixbuf with a
107  *     reference count of 1, or %NULL on error
108  */
109 public Pixbuf getFromWindow(Window window, int srcX, int srcY, int width, int height)
110 {
111 	auto p = gdk_pixbuf_get_from_window((window is null) ? null : window.getWindowStruct(), srcX, srcY, width, height);
112 	
113 	if(p is null)
114 	{
115 		return null;
116 	}
117 	
118 	return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
119 }