2
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#ifndef _GDKMM_PIXBUFLOADER_H
4
#define _GDKMM_PIXBUFLOADER_H
9
/* $Id: pixbufloader.hg,v 1.13 2006/05/18 17:53:14 murrayc Exp $ */
11
/* Copyright (C) 1998-2002 The gtkmm Development Team
13
* This library is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU Lesser General Public
15
* License as published by the Free Software Foundation; either
16
* version 2.1 of the License, or (at your option) any later version.
18
* This library is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
* Lesser General Public License for more details.
23
* You should have received a copy of the GNU Lesser General Public
24
* License along with this library; if not, write to the Free
25
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
#include <glibmm/object.h>
29
#include <gdkmm/pixbuf.h>
30
#include <gdkmm/pixbufanimation.h>
31
#include <gdkmm/pixbufformat.h>
34
#ifndef DOXYGEN_SHOULD_SKIP_THIS
35
typedef struct _GdkPixbufLoader GdkPixbufLoader;
36
typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass;
37
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
41
{ class PixbufLoader_Class; } // namespace Gdk
46
class PixbufLoader : public Glib::Object
49
#ifndef DOXYGEN_SHOULD_SKIP_THIS
52
typedef PixbufLoader CppObjectType;
53
typedef PixbufLoader_Class CppClassType;
54
typedef GdkPixbufLoader BaseObjectType;
55
typedef GdkPixbufLoaderClass BaseClassType;
57
private: friend class PixbufLoader_Class;
58
static CppClassType pixbufloader_class_;
62
PixbufLoader(const PixbufLoader&);
63
PixbufLoader& operator=(const PixbufLoader&);
66
explicit PixbufLoader(const Glib::ConstructParams& construct_params);
67
explicit PixbufLoader(GdkPixbufLoader* castitem);
69
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
72
virtual ~PixbufLoader();
74
#ifndef DOXYGEN_SHOULD_SKIP_THIS
75
static GType get_type() G_GNUC_CONST;
78
static GType get_base_type() G_GNUC_CONST;
81
///Provides access to the underlying C GObject.
82
GdkPixbufLoader* gobj() { return reinterpret_cast<GdkPixbufLoader*>(gobject_); }
84
///Provides access to the underlying C GObject.
85
const GdkPixbufLoader* gobj() const { return reinterpret_cast<GdkPixbufLoader*>(gobject_); }
87
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
88
GdkPixbufLoader* gobj_copy();
94
/** Constructs a pixbuf loader object.
98
/** Constructs a pixbuf loader object for a specific image type.
99
* Constructs a new pixbuf loader object that always attempts to parse image
100
* data as if it were an image of type @a image_type, instead of identifying
101
* the type automatically. Useful if you want an error if the image isn't the
102
* expected type, for loading image formats that can't be reliably identified
103
* by looking at the data, or if the user manually forces a specific type.
105
* The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.
107
* Common MIME Types are listed here
108
* http://www.iana.org/assignments/media-types/
110
* http://www.freedesktop.org/Software/shared-mime-info
112
* The list of non-mime-type image formats depends on what image loaders
113
* are installed, but typically "png", "jpeg", "gif", "tiff" and
114
* "xpm" are among the supported formats. To obtain the full list of
115
* supported image formats, call PixbufFormat::get_name() on each
116
* of the PixbufFormats returned by Gdk::Pixbuf::get_formats().
118
* @param image_type Name of the image format to be loaded with the image.
119
* @param mime_type If this is true then the image_type is a MIME type.
120
* @throw Gdk::PixbufError
122
explicit PixbufLoader(const Glib::ustring& image_type, bool mime_type = false);
126
/** Creates a new pixbuf loader object.
127
* @return A newly-created pixbuf loader.
130
static Glib::RefPtr<PixbufLoader> create();
133
/** Constructs a pixbuf loader object for a specific image type.
134
* Constructs a new pixbuf loader object that always attempts to parse image
135
* data as if it were an image of type @a image_type, instead of identifying
136
* the type automatically. Useful if you want an error if the image isn't the
137
* expected type, for loading image formats that can't be reliably identified
138
* by looking at the data, or if the user manually forces a specific type.
140
* The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.
142
* Common MIME Types are listed here
143
* http://www.iana.org/assignments/media-types/
145
* http://www.freedesktop.org/Software/shared-mime-info
147
* The list of non-mime-type image formats depends on what image loaders
148
* are installed, but typically "png", "jpeg", "gif", "tiff" and
149
* "xpm" are among the supported formats. To obtain the full list of
150
* supported image formats, call PixbufFormat::get_name() on each
151
* of the PixbufFormats returned by Gdk::Pixbuf::get_formats().
153
* @param image_type Name of the image format to be loaded with the image.
154
* @param mime_type If this is true then the image_type is a MIME type.
155
* @throw Gdk::PixbufError
158
static Glib::RefPtr<PixbufLoader> create(const Glib::ustring& image_type, bool mime_type = false);
161
void set_size(int width, int height);
164
/** Causes the pixbuf loader to parse the next @a count bytes of an image.
165
* It will return if the data was loaded successfully, and throw an exception
166
* if an error occurred. In the latter case, the loader will be closed, and
167
* will not accept further writes.
168
* @param buf Pointer to image data.
169
* @param count Length of the @a buf buffer in bytes.
170
* @throw Gdk::PixbufError
171
* @throw Glib::FileError
173
void write(const guint8* buf, gsize count);
176
/** Informs a pixbuf loader that no further writes with PixbufLoader::write()
177
* will occur, so that it can free its internal loading structures. Also,
178
* tries to parse any data that hasn't yet been parsed; if the remaining data
179
* is partial or corrupt, an exception will be thrown. If you're just
180
* cancelling a load rather than expecting it to be finished, writing an
181
* empty <tt>catch()</tt> block to ignore errors is reasonable.
182
* @throw Gdk::PixbufError
183
* @throw Glib::FileError
188
Glib::RefPtr<Gdk::Pixbuf> get_pixbuf();
190
Glib::RefPtr<Gdk::PixbufAnimation> get_animation();
193
PixbufFormat get_format() const;
195
/** This signal is emitted when the pixbuf loader has allocated the
196
* pixbuf in the desired size. After this signal is emitted,
197
* applications can call get_pixbuf() to fetch
198
* the partially-loaded pixbuf.
201
* <tt>void on_my_%area_prepared()</tt>
204
Glib::SignalProxy0< void > signal_area_prepared();
207
/** This signal is emitted when a significant area of the image being
208
* loaded has been updated. Normally it means that a complete
209
* scanline has been read in, but it could be a different area as
210
* well. Applications can use this signal to know when to repaint
211
* areas of an image that is being loaded.
213
* @param X offset of upper-left corner of the updated area.
214
* @param y Y offset of upper-left corner of the updated area.
215
* @param width Width of updated area.
216
* @param height Height of updated area.
219
* <tt>void on_my_%area_updated(int x, int y, int width, int height)</tt>
222
Glib::SignalProxy4< void,int,int,int,int > signal_area_updated();
225
/** This signal is emitted when close() is called.
226
* It can be used by different parts of an application to receive
227
* notification when an image loader is closed by the code that
231
* <tt>void on_my_%closed()</tt>
234
Glib::SignalProxy0< void > signal_closed();
237
/** This signal is emitted when the pixbuf loader has been fed the
238
* initial amount of data that is required to figure out the size
239
* of the image that it will create. Applications can call
240
* set_size() in response to this signal to set
241
* the desired size to which the image should be scaled.
243
* @param width The original width of the image.
244
* @param height The original height of the image
247
* <tt>void on_my_%size_prepared(int width, int height)</tt>
250
Glib::SignalProxy2< void,int,int > signal_size_prepared();
256
//C++ methods used to invoke GTK+ virtual functions:
259
//GTK+ Virtual Functions (override these to change behaviour):
261
//Default Signal Handlers::
262
virtual void on_area_prepared();
263
virtual void on_area_updated(int x, int y, int width, int height);
264
virtual void on_closed();
265
virtual void on_size_prepared(int width, int height);
275
/** A Glib::wrap() method for this object.
277
* @param object The C instance.
278
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
279
* @result A C++ instance that wraps this C instance.
281
* @relates Gdk::PixbufLoader
283
Glib::RefPtr<Gdk::PixbufLoader> wrap(GdkPixbufLoader* object, bool take_copy = false);
287
#endif /* _GDKMM_PIXBUFLOADER_H */