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