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 * - cairo_surface_ 42 * - cairo_ 43 * omit structs: 44 * omit prefixes: 45 * omit code: 46 * omit signals: 47 * imports: 48 * structWrap: 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module cairo.RecordingSurface; 55 56 public import gtkc.cairotypes; 57 58 private import gtkc.cairo; 59 private import glib.ConstructionException; 60 61 62 63 64 65 private import cairo.Surface; 66 67 /** 68 * Description 69 * A recording surface is a surface that records all drawing operations at 70 * the highest level of the surface backend interface, (that is, the 71 * level of paint, mask, stroke, fill, and show_text_glyphs). The recording 72 * surface can then be "replayed" against any target surface by using it 73 * as a source surface. 74 * If you want to replay a surface so that the results in target will be 75 * identical to the results that would have been obtained if the original 76 * operations applied to the recording surface had instead been applied to the 77 * target surface, you can use code like this: 78 * $(DDOC_COMMENT example) 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 * The recording phase of the recording surface is careful to snapshot all 85 * necessary objects (paths, patterns, etc.), in order to achieve 86 * accurate replay. The efficiency of the recording surface could be 87 * improved by improving the implementation of snapshot for the 88 * various objects. For example, it would be nice to have a 89 * copy-on-write implementation for _cairo_surface_snapshot. 90 */ 91 public class RecordingSurface : Surface 92 { 93 94 /** the main Gtk struct */ 95 protected cairo_surface_t* cairo_surface; 96 97 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 }