File: PixbufFormat.d

package info (click to toggle)
gtk-d 3.10.0-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 20,144 kB
  • sloc: javascript: 565; sh: 71; makefile: 23
file content (263 lines) | stat: -rw-r--r-- 6,581 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gdkpixbuf.PixbufFormat;

private import gdkpixbuf.c.functions;
public  import gdkpixbuf.c.types;
private import glib.Str;
private import gobject.ObjectG;
public  import gtkc.gdkpixbuftypes;
private import gtkd.Loader;


/** */
public class PixbufFormat
{
	/** the main Gtk struct */
	protected GdkPixbufFormat* gdkPixbufFormat;
	protected bool ownedRef;

	/** Get the main Gtk struct */
	public GdkPixbufFormat* getPixbufFormatStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gdkPixbufFormat;
	}

	/** the main Gtk struct as a void* */
	protected void* getStruct()
	{
		return cast(void*)gdkPixbufFormat;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GdkPixbufFormat* gdkPixbufFormat, bool ownedRef = false)
	{
		this.gdkPixbufFormat = gdkPixbufFormat;
		this.ownedRef = ownedRef;
	}

	~this ()
	{
		if ( Linker.isLoaded(LIBRARY_GDKPIXBUF) && ownedRef )
			gdk_pixbuf_format_free(gdkPixbufFormat);
	}


	/** */
	public static GType getType()
	{
		return gdk_pixbuf_format_get_type();
	}

	/**
	 * Creates a copy of @format
	 *
	 * Returns: the newly allocated copy of a #GdkPixbufFormat. Use
	 *     gdk_pixbuf_format_free() to free the resources when done
	 *
	 * Since: 2.22
	 */
	public PixbufFormat copy()
	{
		auto p = gdk_pixbuf_format_copy(gdkPixbufFormat);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) p, true);
	}

	/**
	 * Frees the resources allocated when copying a #GdkPixbufFormat
	 * using gdk_pixbuf_format_copy()
	 *
	 * Since: 2.22
	 */
	public void free()
	{
		gdk_pixbuf_format_free(gdkPixbufFormat);
		ownedRef = false;
	}

	/**
	 * Returns a description of the format.
	 *
	 * Returns: a description of the format.
	 *
	 * Since: 2.2
	 */
	public string getDescription()
	{
		auto retStr = gdk_pixbuf_format_get_description(gdkPixbufFormat);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Returns the filename extensions typically used for files in the
	 * given format.
	 *
	 * Returns: a %NULL-terminated array of filename extensions which must be
	 *     freed with g_strfreev() when it is no longer needed.
	 *
	 * Since: 2.2
	 */
	public string[] getExtensions()
	{
		auto retStr = gdk_pixbuf_format_get_extensions(gdkPixbufFormat);

		scope(exit) Str.freeStringArray(retStr);
		return Str.toStringArray(retStr);
	}

	/**
	 * Returns information about the license of the image loader for the format. The
	 * returned string should be a shorthand for a wellknown license, e.g. "LGPL",
	 * "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license.  This
	 * string should be freed with g_free() when it's no longer needed.
	 *
	 * Returns: a string describing the license of @format.
	 *
	 * Since: 2.6
	 */
	public string getLicense()
	{
		auto retStr = gdk_pixbuf_format_get_license(gdkPixbufFormat);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Returns the mime types supported by the format.
	 *
	 * Returns: a %NULL-terminated array of mime types which must be freed with
	 *     g_strfreev() when it is no longer needed.
	 *
	 * Since: 2.2
	 */
	public string[] getMimeTypes()
	{
		auto retStr = gdk_pixbuf_format_get_mime_types(gdkPixbufFormat);

		scope(exit) Str.freeStringArray(retStr);
		return Str.toStringArray(retStr);
	}

	/**
	 * Returns the name of the format.
	 *
	 * Returns: the name of the format.
	 *
	 * Since: 2.2
	 */
	public string getName()
	{
		auto retStr = gdk_pixbuf_format_get_name(gdkPixbufFormat);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Returns whether this image format is disabled. See
	 * gdk_pixbuf_format_set_disabled().
	 *
	 * Returns: whether this image format is disabled.
	 *
	 * Since: 2.6
	 */
	public bool isDisabled()
	{
		return gdk_pixbuf_format_is_disabled(gdkPixbufFormat) != 0;
	}

	/**
	 * Returns %TRUE if the save option specified by @option_key is supported when
	 * saving a pixbuf using the module implementing @format.
	 * See gdk_pixbuf_save() for more information about option keys.
	 *
	 * Params:
	 *     optionKey = the name of an option
	 *
	 * Returns: %TRUE if the specified option is supported
	 *
	 * Since: 2.36
	 */
	public bool isSaveOptionSupported(string optionKey)
	{
		return gdk_pixbuf_format_is_save_option_supported(gdkPixbufFormat, Str.toStringz(optionKey)) != 0;
	}

	/**
	 * Returns whether this image format is scalable. If a file is in a
	 * scalable format, it is preferable to load it at the desired size,
	 * rather than loading it at the default size and scaling the
	 * resulting pixbuf to the desired size.
	 *
	 * Returns: whether this image format is scalable.
	 *
	 * Since: 2.6
	 */
	public bool isScalable()
	{
		return gdk_pixbuf_format_is_scalable(gdkPixbufFormat) != 0;
	}

	/**
	 * Returns whether pixbufs can be saved in the given format.
	 *
	 * Returns: whether pixbufs can be saved in the given format.
	 *
	 * Since: 2.2
	 */
	public bool isWritable()
	{
		return gdk_pixbuf_format_is_writable(gdkPixbufFormat) != 0;
	}

	/**
	 * Disables or enables an image format. If a format is disabled,
	 * gdk-pixbuf won't use the image loader for this format to load
	 * images. Applications can use this to avoid using image loaders
	 * with an inappropriate license, see gdk_pixbuf_format_get_license().
	 *
	 * Params:
	 *     disabled = %TRUE to disable the format @format
	 *
	 * Since: 2.6
	 */
	public void setDisabled(bool disabled)
	{
		gdk_pixbuf_format_set_disabled(gdkPixbufFormat, disabled);
	}
}