package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gdkpixbuf/Ocgtk_gdkpixbuf/GdkPixbuf/Wrappers/Pixbuf_loader/index.html

Module Wrappers.Pixbuf_loader

type t = [ `pixbuf_loader | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new PixbufLoader

val new_with_mime_type : string -> (t, GError.t) result

Create a new PixbufLoader

val new_with_type : string -> (t, GError.t) result

Create a new PixbufLoader

val write_bytes : t -> Glib_bytes.t -> (bool, GError.t) result

Parses the next contents of the given image buffer.

val set_size : t -> int -> int -> unit

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.

val get_pixbuf : t -> [ `pixbuf | `object_ ] Gobject.obj option

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()).

val get_format : t -> [ `pixbuf_format ] Gobject.obj option

Obtains the available information about the format of the currently loading image file.

val get_animation : t -> [ `pixbuf_animation | `object_ ] Gobject.obj option

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-prepared` signal, this function will return `NULL`.

val close : t -> (bool, GError.t) result

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 `FALSE` is returned, `error` will be set to an error from the `GDK_PIXBUF_ERROR` or `G_FILE_ERROR` domains.

If you're just cancelling a load rather than expecting it to be finished, passing `NULL` for `error` to 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.

val on_area_prepared : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_area_updated : ?after:bool -> t -> callback:(x:int -> y:int -> width:int -> height:int -> unit) -> Gobject.Signal.handler_id
val on_closed : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_size_prepared : ?after:bool -> t -> callback:(width:int -> height:int -> unit) -> Gobject.Signal.handler_id