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-Recording-Surfaces.html
27  * outPack = cairo
28  * outFile = RecordingSurface
29  * strct   = cairo_surface_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = RecordingSurface
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = cairo_surface_t
38  * implements:
39  * prefixes:
40  * 	- cairo_recording_surface_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module cairo.RecordingSurface;
53 
54 public  import gtkc.cairotypes;
55 
56 private import gtkc.cairo;
57 private import glib.ConstructionException;
58 
59 
60 
61 
62 
63 private import cairo.Surface;
64 
65 /**
66  * A recording surface is a surface that records all drawing operations at
67  * the highest level of the surface backend interface, (that is, the
68  * level of paint, mask, stroke, fill, and show_text_glyphs). The recording
69  * surface can then be "replayed" against any target surface by using it
70  * as a source surface.
71  *
72  * If you want to replay a surface so that the results in target will be
73  * identical to the results that would have been obtained if the original
74  * operations applied to the recording surface had instead been applied to the
75  * target surface, you can use code like this:
76  *
77  * $(DDOC_COMMENT example)
78  *
79  * A recording surface is logically unbounded, i.e. it has no implicit constraint
80  * on the size of the drawing surface. However, in practice this is rarely
81  * useful as you wish to replay against a particular target surface with
82  * known bounds. For this case, it is more efficient to specify the target
83  * extents to the recording surface upon creation.
84  *
85  * The recording phase of the recording surface is careful to snapshot all
86  * necessary objects (paths, patterns, etc.), in order to achieve
87  * accurate replay. The efficiency of the recording surface could be
88  * improved by improving the implementation of snapshot for the
89  * various objects. For example, it would be nice to have a
90  * copy-on-write implementation for _cairo_surface_snapshot.
91  */
92 public class RecordingSurface : Surface
93 {
94 	
95 	/** the main Gtk struct */
96 	protected cairo_surface_t* cairo_surface;
97 	
98 	
99 	public cairo_surface_t* getRecordingSurfaceStruct()
100 	{
101 		return cairo_surface;
102 	}
103 	
104 	
105 	/** the main Gtk struct as a void* */
106 	protected override void* getStruct()
107 	{
108 		return cast(void*)cairo_surface;
109 	}
110 	
111 	/**
112 	 * Sets our main struct and passes it to the parent class
113 	 */
114 	public this (cairo_surface_t* cairo_surface)
115 	{
116 		super(cast(cairo_surface_t*)cairo_surface);
117 		this.cairo_surface = cairo_surface;
118 	}
119 	
120 	/**
121 	 */
122 	
123 	/**
124 	 * Creates a recording-surface which can be used to record all drawing operations
125 	 * at the highest level (that is, the level of paint, mask, stroke, fill
126 	 * and show_text_glyphs). The recording surface can then be "replayed" against
127 	 * any target surface by using it as a source to drawing operations.
128 	 * The recording phase of the recording surface is careful to snapshot all
129 	 * necessary objects (paths, patterns, etc.), in order to achieve
130 	 * accurate replay.
131 	 * Since 1.10
132 	 * Params:
133 	 * content = the content of the recording surface
134 	 * extents = the extents to record in pixels, can be NULL to record
135 	 * unbounded operations.
136 	 * Returns: a pointer to the newly created surface. The caller owns the surface and should call cairo_surface_destroy() when done with it.
137 	 */
138 	public static cairo_surface_t* create(cairo_content_t content, cairo_rectangle_t* extents)
139 	{
140 		// cairo_surface_t * cairo_recording_surface_create (cairo_content_t content,  const cairo_rectangle_t *extents);
141 		return cairo_recording_surface_create(content, extents);
142 	}
143 	
144 	/**
145 	 * Measures the extents of the operations stored within the recording-surface.
146 	 * This is useful to compute the required size of an image surface (or
147 	 * equivalent) into which to replay the full sequence of drawing operations.
148 	 * Since 1.10
149 	 * Params:
150 	 * x0 = the x-coordinate of the top-left of the ink bounding box
151 	 * y0 = the y-coordinate of the top-left of the ink bounding box
152 	 * width = the width of the ink bounding box
153 	 * height = the height of the ink bounding box
154 	 */
155 	public void inkExtents(double* x0, double* y0, double* width, double* height)
156 	{
157 		// void cairo_recording_surface_ink_extents (cairo_surface_t *surface,  double *x0,  double *y0,  double *width,  double *height);
158 		cairo_recording_surface_ink_extents(cairo_surface, x0, y0, width, height);
159 	}
160 	
161 	/**
162 	 * Get the extents of the recording-surface.
163 	 * Since 1.12
164 	 * Params:
165 	 * extents = the cairo_rectangle_t to be assigned the extents
166 	 * Returns: TRUE if the surface is bounded, of recording type, and not in an error state, otherwise FALSE
167 	 */
168 	public cairo_bool_t getExtents(out cairo_rectangle_t extents)
169 	{
170 		// cairo_bool_t cairo_recording_surface_get_extents (cairo_surface_t *surface,  cairo_rectangle_t *extents);
171 		return cairo_recording_surface_get_extents(cairo_surface, &extents);
172 	}
173 }