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 module gdkpixbuf.PixbufFormat; 26 27 private import gdkpixbuf.c.functions; 28 public import gdkpixbuf.c.types; 29 private import glib.MemorySlice; 30 private import glib.Str; 31 private import glib.c.functions; 32 private import gobject.ObjectG; 33 private import gtkd.Loader; 34 35 36 /** 37 * A `GdkPixbufFormat` contains information about the image format accepted 38 * by a module. 39 * 40 * Only modules should access the fields directly, applications should 41 * use the `gdk_pixbuf_format_*` family of functions. 42 * 43 * Since: 2.2 44 */ 45 public final class PixbufFormat 46 { 47 /** the main Gtk struct */ 48 protected GdkPixbufFormat* gdkPixbufFormat; 49 protected bool ownedRef; 50 51 /** Get the main Gtk struct */ 52 public GdkPixbufFormat* getPixbufFormatStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return gdkPixbufFormat; 57 } 58 59 /** the main Gtk struct as a void* */ 60 protected void* getStruct() 61 { 62 return cast(void*)gdkPixbufFormat; 63 } 64 65 /** 66 * Sets our main struct and passes it to the parent class. 67 */ 68 public this (GdkPixbufFormat* gdkPixbufFormat, bool ownedRef = false) 69 { 70 this.gdkPixbufFormat = gdkPixbufFormat; 71 this.ownedRef = ownedRef; 72 } 73 74 ~this () 75 { 76 if ( Linker.isLoaded(LIBRARY_GDKPIXBUF) && ownedRef ) 77 gdk_pixbuf_format_free(gdkPixbufFormat); 78 } 79 80 81 /** 82 * the name of the image format 83 */ 84 public @property string name() 85 { 86 return Str.toString(gdkPixbufFormat.name); 87 } 88 89 /** Ditto */ 90 public @property void name(string value) 91 { 92 gdkPixbufFormat.name = Str.toStringz(value); 93 } 94 95 /** 96 * the signature of the module 97 */ 98 public @property GdkPixbufModulePattern* signature() 99 { 100 return gdkPixbufFormat.signature; 101 } 102 103 /** Ditto */ 104 public @property void signature(GdkPixbufModulePattern* value) 105 { 106 gdkPixbufFormat.signature = value; 107 } 108 109 /** 110 * the message domain for the `description` 111 */ 112 public @property string domain() 113 { 114 return Str.toString(gdkPixbufFormat.domain); 115 } 116 117 /** Ditto */ 118 public @property void domain(string value) 119 { 120 gdkPixbufFormat.domain = Str.toStringz(value); 121 } 122 123 /** 124 * a description of the image format 125 */ 126 public @property string description() 127 { 128 return Str.toString(gdkPixbufFormat.description); 129 } 130 131 /** Ditto */ 132 public @property void description(string value) 133 { 134 gdkPixbufFormat.description = Str.toStringz(value); 135 } 136 137 /** 138 * the MIME types for the image format 139 */ 140 public @property string[] mimeTypes() 141 { 142 return Str.toStringArray(gdkPixbufFormat.mimeTypes); 143 } 144 145 /** Ditto */ 146 public @property void mimeTypes(string[] value) 147 { 148 gdkPixbufFormat.mimeTypes = Str.toStringzArray(value); 149 } 150 151 /** 152 * typical filename extensions for the 153 * image format 154 */ 155 public @property string[] extensions() 156 { 157 return Str.toStringArray(gdkPixbufFormat.extensions); 158 } 159 160 /** Ditto */ 161 public @property void extensions(string[] value) 162 { 163 gdkPixbufFormat.extensions = Str.toStringzArray(value); 164 } 165 166 /** 167 * a combination of `GdkPixbufFormatFlags` 168 */ 169 public @property uint flags() 170 { 171 return gdkPixbufFormat.flags; 172 } 173 174 /** Ditto */ 175 public @property void flags(uint value) 176 { 177 gdkPixbufFormat.flags = value; 178 } 179 180 /** 181 * a boolean determining whether the loader is disabled` 182 */ 183 public @property bool disabled() 184 { 185 return gdkPixbufFormat.disabled != 0; 186 } 187 188 /** Ditto */ 189 public @property void disabled(bool value) 190 { 191 gdkPixbufFormat.disabled = value; 192 } 193 194 /** 195 * a string containing license information, typically set to 196 * shorthands like "GPL", "LGPL", etc. 197 */ 198 public @property string license() 199 { 200 return Str.toString(gdkPixbufFormat.license); 201 } 202 203 /** Ditto */ 204 public @property void license(string value) 205 { 206 gdkPixbufFormat.license = Str.toStringz(value); 207 } 208 209 /** */ 210 public static GType getType() 211 { 212 return gdk_pixbuf_format_get_type(); 213 } 214 215 /** 216 * Creates a copy of `format`. 217 * 218 * Returns: the newly allocated copy of a `GdkPixbufFormat`. Use 219 * gdk_pixbuf_format_free() to free the resources when done 220 * 221 * Since: 2.22 222 */ 223 public PixbufFormat copy() 224 { 225 auto __p = gdk_pixbuf_format_copy(gdkPixbufFormat); 226 227 if(__p is null) 228 { 229 return null; 230 } 231 232 return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) __p, true); 233 } 234 235 /** 236 * Frees the resources allocated when copying a `GdkPixbufFormat` 237 * using gdk_pixbuf_format_copy() 238 * 239 * Since: 2.22 240 */ 241 public void free() 242 { 243 gdk_pixbuf_format_free(gdkPixbufFormat); 244 ownedRef = false; 245 } 246 247 /** 248 * Returns a description of the format. 249 * 250 * Returns: a description of the format. 251 * 252 * Since: 2.2 253 */ 254 public string getDescription() 255 { 256 auto retStr = gdk_pixbuf_format_get_description(gdkPixbufFormat); 257 258 scope(exit) Str.freeString(retStr); 259 return Str.toString(retStr); 260 } 261 262 /** 263 * Returns the filename extensions typically used for files in the 264 * given format. 265 * 266 * Returns: an array of 267 * filename extensions 268 * 269 * Since: 2.2 270 */ 271 public string[] getExtensions() 272 { 273 auto retStr = gdk_pixbuf_format_get_extensions(gdkPixbufFormat); 274 275 scope(exit) Str.freeStringArray(retStr); 276 return Str.toStringArray(retStr); 277 } 278 279 /** 280 * Returns information about the license of the image loader for the format. 281 * 282 * The returned string should be a shorthand for a well known license, e.g. 283 * "LGPL", "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. 284 * 285 * Returns: a string describing the license of the pixbuf format 286 * 287 * Since: 2.6 288 */ 289 public string getLicense() 290 { 291 auto retStr = gdk_pixbuf_format_get_license(gdkPixbufFormat); 292 293 scope(exit) Str.freeString(retStr); 294 return Str.toString(retStr); 295 } 296 297 /** 298 * Returns the mime types supported by the format. 299 * 300 * Returns: an array of mime types 301 * 302 * Since: 2.2 303 */ 304 public string[] getMimeTypes() 305 { 306 auto retStr = gdk_pixbuf_format_get_mime_types(gdkPixbufFormat); 307 308 scope(exit) Str.freeStringArray(retStr); 309 return Str.toStringArray(retStr); 310 } 311 312 /** 313 * Returns the name of the format. 314 * 315 * Returns: the name of the format. 316 * 317 * Since: 2.2 318 */ 319 public string getName() 320 { 321 auto retStr = gdk_pixbuf_format_get_name(gdkPixbufFormat); 322 323 scope(exit) Str.freeString(retStr); 324 return Str.toString(retStr); 325 } 326 327 /** 328 * Returns whether this image format is disabled. 329 * 330 * See gdk_pixbuf_format_set_disabled(). 331 * 332 * Returns: whether this image format is disabled. 333 * 334 * Since: 2.6 335 */ 336 public bool isDisabled() 337 { 338 return gdk_pixbuf_format_is_disabled(gdkPixbufFormat) != 0; 339 } 340 341 /** 342 * Returns `TRUE` if the save option specified by @option_key is supported when 343 * saving a pixbuf using the module implementing @format. 344 * 345 * See gdk_pixbuf_save() for more information about option keys. 346 * 347 * Params: 348 * optionKey = the name of an option 349 * 350 * Returns: `TRUE` if the specified option is supported 351 * 352 * Since: 2.36 353 */ 354 public bool isSaveOptionSupported(string optionKey) 355 { 356 return gdk_pixbuf_format_is_save_option_supported(gdkPixbufFormat, Str.toStringz(optionKey)) != 0; 357 } 358 359 /** 360 * Returns whether this image format is scalable. 361 * 362 * If a file is in a scalable format, it is preferable to load it at 363 * the desired size, rather than loading it at the default size and 364 * scaling the resulting pixbuf to the desired size. 365 * 366 * Returns: whether this image format is scalable. 367 * 368 * Since: 2.6 369 */ 370 public bool isScalable() 371 { 372 return gdk_pixbuf_format_is_scalable(gdkPixbufFormat) != 0; 373 } 374 375 /** 376 * Returns whether pixbufs can be saved in the given format. 377 * 378 * Returns: whether pixbufs can be saved in the given format. 379 * 380 * Since: 2.2 381 */ 382 public bool isWritable() 383 { 384 return gdk_pixbuf_format_is_writable(gdkPixbufFormat) != 0; 385 } 386 387 /** 388 * Disables or enables an image format. 389 * 390 * If a format is disabled, GdkPixbuf won't use the image loader for 391 * this format to load images. 392 * 393 * Applications can use this to avoid using image loaders with an 394 * inappropriate license, see gdk_pixbuf_format_get_license(). 395 * 396 * Params: 397 * disabled = `TRUE` to disable the format @format 398 * 399 * Since: 2.6 400 */ 401 public void setDisabled(bool disabled) 402 { 403 gdk_pixbuf_format_set_disabled(gdkPixbufFormat, disabled); 404 } 405 }