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