Ardour  9.0-pre0-582-g084a23a80d
Gdk::PixbufLoader Class Reference

#include <pixbufloader.h>

Inheritance diagram for Gdk::PixbufLoader:
[legend]

Public Member Functions

virtual ~PixbufLoader ()
 
GdkPixbufLoader * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkPixbufLoader * gobj () const
 Provides access to the underlying C GObject. More...
 
GdkPixbufLoader * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
void set_size (int width, int height)
 
void write (const guint8 *buf, gsize count)
 
void close ()
 
Glib::RefPtr< Gdk::Pixbufget_pixbuf ()
 
Glib::RefPtr< Gdk::PixbufAnimationget_animation ()
 
PixbufFormat get_format () const
 
Glib::SignalProxy0< void > signal_area_prepared ()
 
Glib::SignalProxy4< void, int, int, int, int > signal_area_updated ()
 
Glib::SignalProxy0< void > signal_closed ()
 
Glib::SignalProxy2< void, int, int > signal_size_prepared ()
 

Static Public Member Functions

static GType get_type () G_GNUC_CONST
 
static Glib::RefPtr< PixbufLoadercreate ()
 
static Glib::RefPtr< PixbufLoadercreate (const Glib::ustring &image_type, bool mime_type=false)
 

Protected Member Functions

 PixbufLoader ()
 
 PixbufLoader (const Glib::ustring &image_type, bool mime_type=false)
 
virtual void on_area_prepared ()
 This is a default handler for the signal signal_area_prepared(). More...
 
virtual void on_area_updated (int x, int y, int width, int height)
 This is a default handler for the signal signal_area_updated(). More...
 
virtual void on_closed ()
 This is a default handler for the signal signal_closed(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::PixbufLoaderwrap (GdkPixbufLoader *object, bool take_copy=false)
 

Detailed Description

Definition at line 50 of file pixbufloader.h.

Constructor & Destructor Documentation

◆ ~PixbufLoader()

virtual Gdk::PixbufLoader::~PixbufLoader ( )
virtual

◆ PixbufLoader() [1/2]

Gdk::PixbufLoader::PixbufLoader ( )
protected

Constructs a pixbuf loader object.

◆ PixbufLoader() [2/2]

Gdk::PixbufLoader::PixbufLoader ( const Glib::ustring &  image_type,
bool  mime_type = false 
)
explicitprotected

Constructs a pixbuf loader object for a specific image type. Constructs a new pixbuf loader object that always attempts to parse image data as if it were an image of type image_type, instead of identifying the type automatically. Useful if you want an error if the image isn't the expected type, for loading image formats that can't be reliably identified by looking at the data, or if the user manually forces a specific type.

The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.

Common MIME Types are listed here http://www.iana.org/assignments/media-types/ and here: http://www.freedesktop.org/Software/shared-mime-info

The list of non-mime-type image formats depends on what image loaders are installed, but typically "png", "jpeg", "gif", "tiff" and "xpm" are among the supported formats. To obtain the full list of supported image formats, call PixbufFormat::get_name() on each of the PixbufFormats returned by Gdk::Pixbuf::get_formats().

Parameters
image_typeName of the image format to be loaded with the image.
mime_typeIf this is true then the image_type is a MIME type.
Exceptions
Gdk::PixbufError

Member Function Documentation

◆ close()

void Gdk::PixbufLoader::close ( )

Informs a pixbuf loader that no further writes with PixbufLoader::write() will occur, so that it can free its internal loading structures. Also, tries to parse any data that hasn't yet been parsed; if the remaining data is partial or corrupt, an exception will be thrown. If you're just cancelling a load rather than expecting it to be finished, writing an empty catch() block to ignore errors is reasonable.

Exceptions
Gdk::PixbufError
Glib::FileError

◆ create() [1/2]

static Glib::RefPtr<PixbufLoader> Gdk::PixbufLoader::create ( )
static

Creates a new pixbuf loader object.

Returns
A newly-created pixbuf loader.

◆ create() [2/2]

static Glib::RefPtr<PixbufLoader> Gdk::PixbufLoader::create ( const Glib::ustring &  image_type,
bool  mime_type = false 
)
static

Constructs a pixbuf loader object for a specific image type. Constructs a new pixbuf loader object that always attempts to parse image data as if it were an image of type image_type, instead of identifying the type automatically. Useful if you want an error if the image isn't the expected type, for loading image formats that can't be reliably identified by looking at the data, or if the user manually forces a specific type.

The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.

Common MIME Types are listed here http://www.iana.org/assignments/media-types/ and here: http://www.freedesktop.org/Software/shared-mime-info

The list of non-mime-type image formats depends on what image loaders are installed, but typically "png", "jpeg", "gif", "tiff" and "xpm" are among the supported formats. To obtain the full list of supported image formats, call PixbufFormat::get_name() on each of the PixbufFormats returned by Gdk::Pixbuf::get_formats().

Parameters
image_typeName of the image format to be loaded with the image.
mime_typeIf this is true then the image_type is a MIME type.
Exceptions
Gdk::PixbufError

◆ get_animation()

Glib::RefPtr<Gdk::PixbufAnimation> Gdk::PixbufLoader::get_animation ( )

◆ get_format()

PixbufFormat Gdk::PixbufLoader::get_format ( ) const

◆ get_pixbuf()

Glib::RefPtr<Gdk::Pixbuf> Gdk::PixbufLoader::get_pixbuf ( )

◆ get_type()

static GType Gdk::PixbufLoader::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GdkPixbufLoader* Gdk::PixbufLoader::gobj ( )
inline

Provides access to the underlying C GObject.

Definition at line 89 of file pixbufloader.h.

◆ gobj() [2/2]

const GdkPixbufLoader* Gdk::PixbufLoader::gobj ( ) const
inline

Provides access to the underlying C GObject.

Definition at line 92 of file pixbufloader.h.

◆ gobj_copy()

GdkPixbufLoader* Gdk::PixbufLoader::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ on_area_prepared()

virtual void Gdk::PixbufLoader::on_area_prepared ( )
protectedvirtual

This is a default handler for the signal signal_area_prepared().

◆ on_area_updated()

virtual void Gdk::PixbufLoader::on_area_updated ( int  x,
int  y,
int  width,
int  height 
)
protectedvirtual

This is a default handler for the signal signal_area_updated().

◆ on_closed()

virtual void Gdk::PixbufLoader::on_closed ( )
protectedvirtual

This is a default handler for the signal signal_closed().

◆ set_size()

void Gdk::PixbufLoader::set_size ( int  width,
int  height 
)

◆ signal_area_prepared()

Glib::SignalProxy0< void > Gdk::PixbufLoader::signal_area_prepared ( )

This signal is emitted when the pixbuf loader has allocated the pixbuf in the desired size. After this signal is emitted, applications can call get_pixbuf() to fetch the partially-loaded pixbuf.

Slot Prototype:
void on_my_area_prepared()

◆ signal_area_updated()

Glib::SignalProxy4< void,int,int,int,int > Gdk::PixbufLoader::signal_area_updated ( )

This signal is emitted when a significant area of the image being loaded has been updated. Normally it means that a complete scanline has been read in, but it could be a different area as well. Applications can use this signal to know when to repaint areas of an image that is being loaded.

Parameters
Xoffset of upper-left corner of the updated area.
yY offset of upper-left corner of the updated area.
widthWidth of updated area.
heightHeight of updated area.
Slot Prototype:
void on_my_area_updated(int x, int y, int width, int height)

◆ signal_closed()

Glib::SignalProxy0< void > Gdk::PixbufLoader::signal_closed ( )

This signal is emitted when close() is called. It can be used by different parts of an application to receive notification when an image loader is closed by the code that drives it.

Slot Prototype:
void on_my_closed()

◆ signal_size_prepared()

Glib::SignalProxy2< void,int,int > Gdk::PixbufLoader::signal_size_prepared ( )

This signal is emitted when the pixbuf loader has been fed the initial amount of data that is required to figure out the size of the image that it will create. Applications can call
set_size() in response to this signal to set the desired size to which the image should be scaled.

Parameters
widthThe original width of the image.
heightThe original height of the image
Slot Prototype:
void on_my_size_prepared(int width, int height)

◆ write()

void Gdk::PixbufLoader::write ( const guint8 *  buf,
gsize  count 
)

Causes the pixbuf loader to parse the next count bytes of an image. It will return if the data was loaded successfully, and throw an exception if an error occurred. In the latter case, the loader will be closed, and will not accept further writes.

Parameters
bufPointer to image data.
countLength of the buf buffer in bytes.
Exceptions
Gdk::PixbufError
Glib::FileError

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::PixbufLoader > wrap ( GdkPixbufLoader *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file: