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 = gdk 28 * outFile = Bitmap 29 * strct = GdkBitmap 30 * realStrct= 31 * ctorStrct= 32 * clss = Bitmap 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gdk_bitmap_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gdk.Drawable 48 * structWrap: 49 * - GdkBitmap* -> Bitmap 50 * - GdkDrawable* -> Drawable 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gdk.Bitmap; 57 58 public import gtkc.gdktypes; 59 60 private import gtkc.gdk; 61 private import glib.ConstructionException; 62 private import gobject.ObjectG; 63 64 65 private import glib.Str; 66 private import gdk.Drawable; 67 68 69 70 71 /** 72 * Description 73 * Pixmaps are offscreen drawables. They can be drawn upon with the 74 * standard drawing primitives, then copied to another drawable (such as 75 * a GdkWindow) with gdk_pixmap_draw(). The depth of a pixmap 76 * is the number of bits per pixels. Bitmaps are simply pixmaps 77 * with a depth of 1. (That is, they are monochrome bitmaps - each 78 * pixel can be either on or off). 79 * GTK 3 will remove GdkPixmap and GdkBitmap. You should use cairo 80 * surfaces instead. However, because a lot of functions still use these 81 * types, they are not deprecated. 82 */ 83 public class Bitmap 84 { 85 86 /** the main Gtk struct */ 87 protected GdkBitmap* gdkBitmap; 88 89 90 public GdkBitmap* getBitmapStruct() 91 { 92 return gdkBitmap; 93 } 94 95 96 /** the main Gtk struct as a void* */ 97 protected void* getStruct() 98 { 99 return cast(void*)gdkBitmap; 100 } 101 102 /** 103 * Sets our main struct and passes it to the parent class 104 */ 105 public this (GdkBitmap* gdkBitmap) 106 { 107 this.gdkBitmap = gdkBitmap; 108 } 109 110 /** 111 */ 112 113 /** 114 * Warning 115 * gdk_bitmap_create_from_data has been deprecated since version 2.22 and should not be used in newly-written code. You can create a Cairo image surface using 116 * cairo_image_surface_create_for_data() instead. Specify 117 * CAIRO_FORMAT_A1 as the format to get a bitmap. Keep in mind that 118 * Cairo images must have a rowstride of 4 bytes, so you will need 119 * to align your data properly. If you must use a pixmap, use 120 * gdk_pixmap_new() with a depth of 1 to create a bitmap and then use 121 * gdk_cairo_create(), cairo_set_source_surface() and cairo_paint() 122 * to draw the image surface to the bitmap. 123 * Creates a new bitmap from data in XBM format. 124 * Params: 125 * drawable = a GdkDrawable, used to determine default values 126 * for the new pixmap. Can be NULL, in which case the root 127 * window is used. 128 * data = a pointer to the XBM data. 129 * width = the width of the new pixmap in pixels. 130 * height = the height of the new pixmap in pixels. 131 * Returns: the GdkBitmap 132 */ 133 public static Bitmap createFromData(Drawable drawable, string data, int width, int height) 134 { 135 // GdkBitmap * gdk_bitmap_create_from_data (GdkDrawable *drawable, const gchar *data, gint width, gint height); 136 auto p = gdk_bitmap_create_from_data((drawable is null) ? null : drawable.getDrawableStruct(), Str.toStringz(data), width, height); 137 138 if(p is null) 139 { 140 return null; 141 } 142 143 return ObjectG.getDObject!(Bitmap)(cast(GdkBitmap*) p); 144 } 145 }