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  = 
27  * outPack = cairo
28  * outFile = ScriptSurface
29  * strct   = cairo_surface_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = ScriptSurface
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = cairo_surface_t
38  * implements:
39  * prefixes:
40  * 	- cairo_script_surface_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- cairo.Device
47  * 	- cairo.Surface
48  * structWrap:
49  * 	- cairo_device_t* -> Device
50  * 	- cairo_surface_t* -> Surface
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module cairo.ScriptSurface;
57 
58 public  import cairo.c.types;
59 
60 private import cairo.c.functions;
61 private import glib.ConstructionException;
62 
63 private import cairo.Device;
64 private import cairo.Surface;
65 
66 
67 private import cairo.Surface;
68 
69 /**
70  * The script surface provides the ability to render to a native
71  * script that matches the cairo drawing model. The scripts can
72  * be replayed using tools under the util/cairo-script directoriy,
73  * or with cairo-perf-trace.
74  */
75 public class ScriptSurface : Surface
76 {
77 	
78 	/** the main Gtk struct */
79 	protected cairo_surface_t* cairo_surface;
80 	
81 	
82 	/** Get the main Gtk struct */
83 	public cairo_surface_t* getScriptSurfaceStruct()
84 	{
85 		return cairo_surface;
86 	}
87 	
88 	
89 	/** the main Gtk struct as a void* */
90 	protected override void* getStruct()
91 	{
92 		return cast(void*)cairo_surface;
93 	}
94 	
95 	/**
96 	 * Sets our main struct and passes it to the parent class
97 	 */
98 	public this (cairo_surface_t* cairo_surface)
99 	{
100 		super(cast(cairo_surface_t*)cairo_surface);
101 		this.cairo_surface = cairo_surface;
102 	}
103 	
104 	/**
105 	 */
106 	
107 	/**
108 	 * Create a new surface that will emit its rendering through script
109 	 * Since 1.12
110 	 * Params:
111 	 * script = the script (output device)
112 	 * content = the content of the surface
113 	 * width = width in pixels
114 	 * height = height in pixels
115 	 * Returns: a pointer to the newly created surface. The caller owns the surface and should call cairo_surface_destroy() when done with it. This function always returns a valid pointer, but it will return a pointer to a "nil" surface if an error such as out of memory occurs. You can use cairo_surface_status() to check for this.
116 	 */
117 	public static Surface create(Device script, cairo_content_t content, double width, double height)
118 	{
119 		// cairo_surface_t * cairo_script_surface_create (cairo_device_t *script,  cairo_content_t content,  double width,  double height);
120 		auto p = cairo_script_surface_create((script is null) ? null : script.getDeviceStruct(), content, width, height);
121 		
122 		if(p is null)
123 		{
124 			return null;
125 		}
126 		
127 		return new Surface(cast(cairo_surface_t*) p);
128 	}
129 	
130 	/**
131 	 * Create a pxoy surface that will render to target and record
132 	 * the operations to device.
133 	 * Since 1.12
134 	 * Params:
135 	 * script = the script (output device)
136 	 * target = a target surface to wrap
137 	 * Returns: a pointer to the newly created surface. The caller owns the surface and should call cairo_surface_destroy() when done with it. This function always returns a valid pointer, but it will return a pointer to a "nil" surface if an error such as out of memory occurs. You can use cairo_surface_status() to check for this.
138 	 */
139 	public static Surface createForTarget(Device script, Surface target)
140 	{
141 		// cairo_surface_t * cairo_script_surface_create_for_target  (cairo_device_t *script,  cairo_surface_t *target);
142 		auto p = cairo_script_surface_create_for_target((script is null) ? null : script.getDeviceStruct(), (target is null) ? null : target.getSurfaceStruct());
143 		
144 		if(p is null)
145 		{
146 			return null;
147 		}
148 		
149 		return new Surface(cast(cairo_surface_t*) p);
150 	}
151 }