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