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  * Conversion parameters:
26  * inFile  = cairo-Raster-Sources.html
27  * outPack = cairo
28  * outFile = RasterSource
29  * strct   = cairo_pattern_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = RasterSource
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = cairo_pattern_t
38  * implements:
39  * prefixes:
40  * 	- cairo_raster_source_pattern_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- cairo_pattern_create_raster_source
45  * omit signals:
46  * imports:
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module cairo.RasterSource;
54 
55 public  import gtkc.cairotypes;
56 
57 private import gtkc.cairo;
58 private import glib.ConstructionException;
59 
60 
61 
62 
63 
64 private import cairo.Pattern;
65 
66 /**
67  * The raster source provides the ability to supply arbitrary pixel data
68  * whilst rendering. The pixels are queried at the time of rasterisation
69  * by means of user callback functions, allowing for the ultimate
70  * flexibility. For example, in handling compressed image sources, you
71  * may keep a MRU cache of decompressed images and decompress sources on the
72  * fly and discard old ones to conserve memory.
73  *
74  * For the raster source to be effective, you must at least specify
75  * the acquire and release callbacks which are used to retrieve the pixel
76  * data for the region of interest and demark when it can be freed afterwards.
77  * Other callbacks are provided for when the pattern is copied temporarily
78  * during rasterisation, or more permanently as a snapshot in order to keep
79  * the pixel data available for printing.
80  */
81 public class RasterSource : Pattern
82 {
83 	
84 	/** the main Gtk struct */
85 	protected cairo_pattern_t* cairo_pattern;
86 	
87 	
88 	public cairo_pattern_t* getRasterSourceStruct()
89 	{
90 		return cairo_pattern;
91 	}
92 	
93 	
94 	/** the main Gtk struct as a void* */
95 	protected override void* getStruct()
96 	{
97 		return cast(void*)cairo_pattern;
98 	}
99 	
100 	/**
101 	 * Sets our main struct and passes it to the parent class
102 	 */
103 	public this (cairo_pattern_t* cairo_pattern)
104 	{
105 		super(cast(cairo_pattern_t*)cairo_pattern);
106 		this.cairo_pattern = cairo_pattern;
107 	}
108 	
109 	/**
110 	 * Creates a new user pattern for providing pixel data.
111 	 *
112 	 * Use the setter functions to associate callbacks with the returned
113 	 * pattern. The only mandatory callback is acquire.
114 	 *
115 	 * Since 1.12
116 	 *
117 	 * Params:
118 	 *     userData = the user data to be passed to all callbacks
119 	 *     content  = content type for the pixel data that will be returned.
120 	 *                Knowing the content type ahead of time is used for analysing
121 	 *                the operation and picking the appropriate rendering path.
122 	 *     width    = maximum size of the sample area
123 	 *     height   = maximum size of the sample area
124 	 */
125 	public this(void* userData, CairoContent content, int width, int height)
126 	{
127 		// cairo_pattern_t * cairo_pattern_create_raster_source (void *user_data,  cairo_content_t content,  int width,  int height);
128 		this(cairo_pattern_create_raster_source(userData, content, width, height));
129 	}
130 	
131 	/**
132 	 */
133 	
134 	/**
135 	 * Updates the user data that is provided to all callbacks.
136 	 * Since 1.12
137 	 * Params:
138 	 * data = the user data to be passed to all callbacks
139 	 */
140 	public void setCallbackData(void* data)
141 	{
142 		// void cairo_raster_source_pattern_set_callback_data  (cairo_pattern_t *pattern,  void *data);
143 		cairo_raster_source_pattern_set_callback_data(cairo_pattern, data);
144 	}
145 	
146 	/**
147 	 * Queries the current user data.
148 	 * Since 1.12
149 	 * Returns: the current user-data passed to each callback
150 	 */
151 	public void* getCallbackData()
152 	{
153 		// void * cairo_raster_source_pattern_get_callback_data  (cairo_pattern_t *pattern);
154 		return cairo_raster_source_pattern_get_callback_data(cairo_pattern);
155 	}
156 	
157 	/**
158 	 * Specifies the callbacks used to generate the image surface for a rendering
159 	 * operation (acquire) and the function used to cleanup that surface afterwards.
160 	 * The acquire callback should create a surface (preferably an image
161 	 * surface created to match the target using
162 	 * cairo_surface_create_similar_image()) that defines at least the region
163 	 * of interest specified by extents. The surface is allowed to be the entire
164 	 * sample area, but if it does contain a subsection of the sample area,
165 	 * the surface extents should be provided by setting the device offset (along
166 	 * with its width and height) using cairo_surface_set_device_offset().
167 	 * Since 1.12
168 	 * Params:
169 	 * acquire = acquire callback
170 	 * release = release callback
171 	 */
172 	public void setAcquire(cairo_raster_source_acquire_func_t acquire, cairo_raster_source_release_func_t release)
173 	{
174 		// void cairo_raster_source_pattern_set_acquire  (cairo_pattern_t *pattern,  cairo_raster_source_acquire_func_t acquire,  cairo_raster_source_release_func_t release);
175 		cairo_raster_source_pattern_set_acquire(cairo_pattern, acquire, release);
176 	}
177 	
178 	/**
179 	 * Queries the current acquire and release callbacks.
180 	 * Since 1.12
181 	 * Params:
182 	 * acquire = return value for the current acquire callback
183 	 * release = return value for the current release callback
184 	 */
185 	public void getAcquire(cairo_raster_source_acquire_func_t* acquire, cairo_raster_source_release_func_t* release)
186 	{
187 		// void cairo_raster_source_pattern_get_acquire  (cairo_pattern_t *pattern,  cairo_raster_source_acquire_func_t *acquire,  cairo_raster_source_release_func_t *release);
188 		cairo_raster_source_pattern_get_acquire(cairo_pattern, acquire, release);
189 	}
190 	
191 	/**
192 	 * Sets the callback that will be used whenever a snapshot is taken of the
193 	 * pattern, that is whenever the current contents of the pattern should be
194 	 * preserved for later use. This is typically invoked whilst printing.
195 	 * Since 1.12
196 	 * Params:
197 	 * snapshot = snapshot callback
198 	 */
199 	public void setSnapshot(cairo_raster_source_snapshot_func_t snapshot)
200 	{
201 		// void cairo_raster_source_pattern_set_snapshot  (cairo_pattern_t *pattern,  cairo_raster_source_snapshot_func_t snapshot);
202 		cairo_raster_source_pattern_set_snapshot(cairo_pattern, snapshot);
203 	}
204 	
205 	/**
206 	 * Queries the current snapshot callback.
207 	 * Since 1.12
208 	 * Returns: the current snapshot callback
209 	 */
210 	public cairo_raster_source_snapshot_func_t getSnapshot()
211 	{
212 		// cairo_raster_source_snapshot_func_t cairo_raster_source_pattern_get_snapshot  (cairo_pattern_t *pattern);
213 		return cairo_raster_source_pattern_get_snapshot(cairo_pattern);
214 	}
215 	
216 	/**
217 	 * Updates the copy callback which is used whenever a temporary copy of the
218 	 * pattern is taken.
219 	 * Since 1.12
220 	 * Params:
221 	 * copy = the copy callback
222 	 */
223 	public void setCopy(cairo_raster_source_copy_func_t copy)
224 	{
225 		// void cairo_raster_source_pattern_set_copy  (cairo_pattern_t *pattern,  cairo_raster_source_copy_func_t copy);
226 		cairo_raster_source_pattern_set_copy(cairo_pattern, copy);
227 	}
228 	
229 	/**
230 	 * Queries the current copy callback.
231 	 * Since 1.12
232 	 * Returns: the current copy callback
233 	 */
234 	public cairo_raster_source_copy_func_t getCopy()
235 	{
236 		// cairo_raster_source_copy_func_t cairo_raster_source_pattern_get_copy  (cairo_pattern_t *pattern);
237 		return cairo_raster_source_pattern_get_copy(cairo_pattern);
238 	}
239 	
240 	/**
241 	 * Updates the finish callback which is used whenever a pattern (or a copy
242 	 * thereof) will no longer be used.
243 	 * Since 1.12
244 	 * Params:
245 	 * finish = the finish callback
246 	 */
247 	public void setFinish(cairo_raster_source_finish_func_t finish)
248 	{
249 		// void cairo_raster_source_pattern_set_finish  (cairo_pattern_t *pattern,  cairo_raster_source_finish_func_t finish);
250 		cairo_raster_source_pattern_set_finish(cairo_pattern, finish);
251 	}
252 	
253 	/**
254 	 * Queries the current finish callback.
255 	 * Since 1.12
256 	 * Returns: the current finish callback
257 	 */
258 	public cairo_raster_source_finish_func_t getFinish()
259 	{
260 		// cairo_raster_source_finish_func_t cairo_raster_source_pattern_get_finish  (cairo_pattern_t *pattern);
261 		return cairo_raster_source_pattern_get_finish(cairo_pattern);
262 	}
263 }