[44:7] extends: object
Incremental image loader. GdkPixbufLoader provides a way for applications
to drive the process of loading an image, by letting them send the image data
directly to the loader instead of having the loader read the data from a
file. Applications can use this functionality instead of
gdk_pixbuf_new_from_file() or gdk_pixbuf_animation_new_from_file() when
they need to parse image data in small chunks. For example, it should be used
when reading an image from a (potentially) slow network connection, or when
loading an extremely large file. To use GdkPixbufLoader to load an image,
create a new instance, and call [method@GdkPixbuf.PixbufLoader.write] to send
the data to it. When done, [method@GdkPixbuf.PixbufLoader.close] should be
called to end the stream and finalize everything. The loader will emit three
important signals throughout the process: -
[signal@GdkPixbuf.PixbufLoader::size-prepared] will be emitted as soon as the
image has enough information to determine the size of the image to be used.
If you want to scale the image while loading it, you can call
[method@GdkPixbuf.PixbufLoader.set_size] in response to this signal. -
[signal@GdkPixbuf.PixbufLoader::area-prepared] will be emitted as soon as the
pixbuf of the desired has been allocated. You can obtain the GdkPixbuf
instance by calling [method@GdkPixbuf.PixbufLoader.get_pixbuf]. If you want
to use it, simply acquire a reference to it. You can also call
gdk_pixbuf_loader_get_pixbuf() later to get the same pixbuf. -
[signal@GdkPixbuf.PixbufLoader::area-updated] will be emitted every time a
region is updated. This way you can update a partially completed image. Note
that you do not know anything about the completeness of an image from the
updated area. For example, in an interlaced image you will need to make
several passes before the image is done loading. ## Loading an animation
Loading an animation is almost as easy as loading an image. Once the first
[signal@GdkPixbuf.PixbufLoader::area-prepared] signal has been emitted, you
can call [method@GdkPixbuf.PixbufLoader.get_animation] to get the
[class@GdkPixbuf.PixbufAnimation] instance, and then call and
[method@GdkPixbuf.PixbufAnimation.get_iter] to get a
[class@GdkPixbuf.PixbufAnimationIter] to retrieve the pixbuf for the desired
time stamp.
PixbufLoader (mime_type = null)
Creates a new pixbuf loader object.
mime_type is the mime type to be loaded.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnAreaprepared (callback Fn, UserData = null)
This signal is emitted when the pixbuf loader has allocated the pixbuf in the desired size. After this signal is emitted, applications can call gdk_pixbuf_loader_get_pixbuf() to fetch the partially-loaded pixbuf.
Fn is the Aussom callback.Fn is called with (PixbufLoader Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.setOnAreaupdated (callback Fn, UserData = null)
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.
Fn is the Aussom callback.Fn is called with (PixbufLoader Self, int X, int Y, int Width, int Height).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.setOnClosed (callback Fn, UserData = null)
This signal is emitted when gdk_pixbuf_loader_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.
Fn is the Aussom callback.Fn is called with (PixbufLoader Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.setOnSizeprepared (callback Fn, UserData = null)
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 gdk_pixbuf_loader_set_size() in response to this signal to set the desired size to which the image should be scaled.
Fn is the Aussom callback.Fn is called with (PixbufLoader Self, int Width, int Height).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.close ()
Informs a pixbuf loader that no further writes with gdk_pixbuf_loader_write() will occur, so that it can free its internal loading structures. This function also tries to parse any data that hasn't yet been parsed; if the remaining data is partial or corrupt, an error will be returned. If
FALSEis returned,errorwill be set to an error from theGDK_PIXBUF_ERRORorG_FILE_ERRORdomains. If you're just cancelling a load rather than expecting it to be finished, passingNULLforerrorto ignore it is reasonable. Remember that this function does not release a reference on the loader, so you will need to explicitly release any reference you hold.
get_animation ()
Queries the #GdkPixbufAnimation that a pixbuf loader is currently creating. In general it only makes sense to call this function after the [signal@GdkPixbuf.PixbufLoader::area-prepared] signal has been emitted by the loader. If the loader doesn't have enough bytes yet, and hasn't emitted the
area-preparedsignal, this function will returnNULL.
get_format ()
Obtains the available information about the format of the currently loading image file.
get_pixbuf ()
Queries the #GdkPixbuf that a pixbuf loader is currently creating. In general it only makes sense to call this function after the [signal@GdkPixbuf.PixbufLoader::area-prepared] signal has been emitted by the loader; this means that enough data has been read to know the size of the image that will be allocated. If the loader has not received enough data via gdk_pixbuf_loader_write(), then this function returns
NULL. The returned pixbuf will be the same in all future calls to the loader, so if you want to keep using it, you should acquire a reference to it. Additionally, if the loader is an animation, it will return the "static image" of the animation (see gdk_pixbuf_animation_get_static_image()).
set_size (int width, int height)
Causes the image to be scaled while it is loaded. The desired image size can be determined relative to the original size of the image by calling gdk_pixbuf_loader_set_size() from a signal handler for the ::size-prepared signal. Attempts to set the desired image size are ignored after the emission of the ::size-prepared signal.
width is The desired width of the image being loaded..height is The desired height of the image being loaded..None.write_bytes (object buffer)
Parses the next contents of the given image buffer.
buffer is The image data as a GBytes buffer..[519:7] extends: object
Generated low-level callback wrapper for GIR callback closed.
PixbufLoaderClosedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[449:7] extends: object
Generated low-level callback wrapper for GIR callback area-updated.
PixbufLoaderAreaupdatedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, x, y, width, height, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[351:14] static extends: object
Alternate constructors for PixbufLoader. Usage:
PixbufLoaderCtors.<name>(...). The primary constructor lives
directly on PixbufLoader.
newWithType (string image_type)
Creates 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. This function is 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 list of supported 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 gdk_pixbuf_format_get_name() on each of the #GdkPixbufFormat structs returned by gdk_pixbuf_get_formats().
image_type is name of the image format to be loaded with the image.A new PixbufLoader.[589:7] extends: object
Generated low-level callback wrapper for GIR callback size-prepared.
PixbufLoaderSizepreparedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, width, height, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[659:14] static extends: object
Generated metadata helpers for PixbufLoader class surfaces.
signals ()
Returns signal metadata for
PixbufLoader.
A list.[379:7] extends: object
Generated low-level callback wrapper for GIR callback area-prepared.
PixbufLoaderAreapreparedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.