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 gtkc.cairotypes; 59 60 private import gtkc.cairo; 61 private import glib.ConstructionException; 62 63 64 private import cairo.Device; 65 private import cairo.Surface; 66 67 68 69 private import cairo.Surface; 70 71 /** 72 * The script surface provides the ability to render to a native 73 * script that matches the cairo drawing model. The scripts can 74 * be replayed using tools under the util/cairo-script directoriy, 75 * or with cairo-perf-trace. 76 */ 77 public class ScriptSurface : Surface 78 { 79 80 /** the main Gtk struct */ 81 protected cairo_surface_t* cairo_surface; 82 83 84 public cairo_surface_t* getScriptSurfaceStruct() 85 { 86 return cairo_surface; 87 } 88 89 90 /** the main Gtk struct as a void* */ 91 protected override void* getStruct() 92 { 93 return cast(void*)cairo_surface; 94 } 95 96 /** 97 * Sets our main struct and passes it to the parent class 98 */ 99 public this (cairo_surface_t* cairo_surface) 100 { 101 super(cast(cairo_surface_t*)cairo_surface); 102 this.cairo_surface = cairo_surface; 103 } 104 105 /** 106 */ 107 108 /** 109 * Create a new surface that will emit its rendering through script 110 * Since 1.12 111 * Params: 112 * script = the script (output device) 113 * content = the content of the surface 114 * width = width in pixels 115 * height = height in pixels 116 * 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. 117 */ 118 public static Surface create(Device script, cairo_content_t content, double width, double height) 119 { 120 // cairo_surface_t * cairo_script_surface_create (cairo_device_t *script, cairo_content_t content, double width, double height); 121 auto p = cairo_script_surface_create((script is null) ? null : script.getDeviceStruct(), content, width, height); 122 123 if(p is null) 124 { 125 return null; 126 } 127 128 return new Surface(cast(cairo_surface_t*) p); 129 } 130 131 /** 132 * Create a pxoy surface that will render to target and record 133 * the operations to device. 134 * Since 1.12 135 * Params: 136 * script = the script (output device) 137 * target = a target surface to wrap 138 * 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. 139 */ 140 public static Surface createForTarget(Device script, Surface target) 141 { 142 // cairo_surface_t * cairo_script_surface_create_for_target (cairo_device_t *script, cairo_surface_t *target); 143 auto p = cairo_script_surface_create_for_target((script is null) ? null : script.getDeviceStruct(), (target is null) ? null : target.getSurfaceStruct()); 144 145 if(p is null) 146 { 147 return null; 148 } 149 150 return new Surface(cast(cairo_surface_t*) p); 151 } 152 }