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 size specified by the @width and @height arguments scaled by the
80  * scale factor of @window. The pixbuf will contain an alpha channel if
81  * the @window contains one.
82  *
83  * If the window is off the screen, then there is no image data in the
84  * obscured/offscreen regions to be placed in the pixbuf. The contents of
85  * portions of the pixbuf corresponding to the offscreen region are undefined.
86  *
87  * If the window you’re obtaining data from is partially obscured by
88  * other windows, then the contents of the pixbuf areas corresponding
89  * to the obscured regions are undefined.
90  *
91  * If the window is not mapped (typically because it’s iconified/minimized
92  * or not on the current workspace), then %NULL will be returned.
93  *
94  * If memory can’t be allocated for the return value, %NULL will be returned
95  * instead.
96  *
97  * (In short, there are several ways this function can fail, and if it fails
98  * it returns %NULL; so check the return value.)
99  *
100  * Params:
101  *     window = Source window
102  *     srcX = Source X coordinate within @window
103  *     srcY = Source Y coordinate within @window
104  *     width = Width in pixels of region to get
105  *     height = Height in pixels of region to get
106  *
107  * Return: A newly-created pixbuf with a
108  *     reference count of 1, or %NULL on error
109  */
110 public Pixbuf getFromWindow(Window window, int srcX, int srcY, int width, int height)
111 {
112 	auto p = gdk_pixbuf_get_from_window((window is null) ? null : window.getWindowStruct(), srcX, srcY, width, height);
113 	
114 	if(p is null)
115 	{
116 		return null;
117 	}
118 	
119 	return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
120 }