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 glib.Str;
28 private import gobject.ObjectG;
29 private import gtkc.gdkpixbuf;
30 public  import gtkc.gdkpixbuftypes;
31 
32 
33 public class PixbufFormat
34 {
35 	/** the main Gtk struct */
36 	protected GdkPixbufFormat* gdkPixbufFormat;
37 
38 	/** Get the main Gtk struct */
39 	public GdkPixbufFormat* getPixbufFormatStruct()
40 	{
41 		return gdkPixbufFormat;
42 	}
43 
44 	/** the main Gtk struct as a void* */
45 	protected void* getStruct()
46 	{
47 		return cast(void*)gdkPixbufFormat;
48 	}
49 
50 	/**
51 	 * Sets our main struct and passes it to the parent class.
52 	 */
53 	public this (GdkPixbufFormat* gdkPixbufFormat)
54 	{
55 		this.gdkPixbufFormat = gdkPixbufFormat;
56 	}
57 
58 	/**
59 	 */
60 
61 	public static GType getType()
62 	{
63 		return gdk_pixbuf_format_get_type();
64 	}
65 
66 	/**
67 	 * Creates a copy of @format
68 	 *
69 	 * Return: the newly allocated copy of a #GdkPixbufFormat. Use
70 	 *     gdk_pixbuf_format_free() to free the resources when done
71 	 *
72 	 * Since: 2.22
73 	 */
74 	public PixbufFormat copy()
75 	{
76 		auto p = gdk_pixbuf_format_copy(gdkPixbufFormat);
77 		
78 		if(p is null)
79 		{
80 			return null;
81 		}
82 		
83 		return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) p);
84 	}
85 
86 	/**
87 	 * Frees the resources allocated when copying a #GdkPixbufFormat
88 	 * using gdk_pixbuf_format_copy()
89 	 *
90 	 * Since: 2.22
91 	 */
92 	public void free()
93 	{
94 		gdk_pixbuf_format_free(gdkPixbufFormat);
95 	}
96 
97 	/**
98 	 * Returns a description of the format.
99 	 *
100 	 * Return: a description of the format.
101 	 *
102 	 * Since: 2.2
103 	 */
104 	public string getDescription()
105 	{
106 		return Str.toString(gdk_pixbuf_format_get_description(gdkPixbufFormat));
107 	}
108 
109 	/**
110 	 * Returns the filename extensions typically used for files in the
111 	 * given format.
112 	 *
113 	 * Return: a %NULL-terminated array of filename extensions which must be
114 	 *     freed with g_strfreev() when it is no longer needed.
115 	 *
116 	 * Since: 2.2
117 	 */
118 	public string[] getExtensions()
119 	{
120 		return Str.toStringArray(gdk_pixbuf_format_get_extensions(gdkPixbufFormat));
121 	}
122 
123 	/**
124 	 * Returns information about the license of the image loader for the format. The
125 	 * returned string should be a shorthand for a wellknown license, e.g. "LGPL",
126 	 * "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license.  This
127 	 * string should be freed with g_free() when it's no longer needed.
128 	 *
129 	 * Return: a string describing the license of @format.
130 	 *
131 	 * Since: 2.6
132 	 */
133 	public string getLicense()
134 	{
135 		return Str.toString(gdk_pixbuf_format_get_license(gdkPixbufFormat));
136 	}
137 
138 	/**
139 	 * Returns the mime types supported by the format.
140 	 *
141 	 * Return: a %NULL-terminated array of mime types which must be freed with
142 	 *     g_strfreev() when it is no longer needed.
143 	 *
144 	 * Since: 2.2
145 	 */
146 	public string[] getMimeTypes()
147 	{
148 		return Str.toStringArray(gdk_pixbuf_format_get_mime_types(gdkPixbufFormat));
149 	}
150 
151 	/**
152 	 * Returns the name of the format.
153 	 *
154 	 * Return: the name of the format.
155 	 *
156 	 * Since: 2.2
157 	 */
158 	public string getName()
159 	{
160 		return Str.toString(gdk_pixbuf_format_get_name(gdkPixbufFormat));
161 	}
162 
163 	/**
164 	 * Returns whether this image format is disabled. See
165 	 * gdk_pixbuf_format_set_disabled().
166 	 *
167 	 * Return: whether this image format is disabled.
168 	 *
169 	 * Since: 2.6
170 	 */
171 	public bool isDisabled()
172 	{
173 		return gdk_pixbuf_format_is_disabled(gdkPixbufFormat) != 0;
174 	}
175 
176 	/**
177 	 * Returns whether this image format is scalable. If a file is in a
178 	 * scalable format, it is preferable to load it at the desired size,
179 	 * rather than loading it at the default size and scaling the
180 	 * resulting pixbuf to the desired size.
181 	 *
182 	 * Return: whether this image format is scalable.
183 	 *
184 	 * Since: 2.6
185 	 */
186 	public bool isScalable()
187 	{
188 		return gdk_pixbuf_format_is_scalable(gdkPixbufFormat) != 0;
189 	}
190 
191 	/**
192 	 * Returns whether pixbufs can be saved in the given format.
193 	 *
194 	 * Return: whether pixbufs can be saved in the given format.
195 	 *
196 	 * Since: 2.2
197 	 */
198 	public bool isWritable()
199 	{
200 		return gdk_pixbuf_format_is_writable(gdkPixbufFormat) != 0;
201 	}
202 
203 	/**
204 	 * Disables or enables an image format. If a format is disabled,
205 	 * gdk-pixbuf won't use the image loader for this format to load
206 	 * images. Applications can use this to avoid using image loaders
207 	 * with an inappropriate license, see gdk_pixbuf_format_get_license().
208 	 *
209 	 * Params:
210 	 *     disabled = %TRUE to disable the format @format
211 	 *
212 	 * Since: 2.6
213 	 */
214 	public void setDisabled(bool disabled)
215 	{
216 		gdk_pixbuf_format_set_disabled(gdkPixbufFormat, disabled);
217 	}
218 }