Gly.Loader¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
|||
r/w/co |
|||
r/w |
|||
r/w/co |
|||
r/w |
|||
r/w |
|||
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gly.Loader(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
[class`Loader`] prepares loading an image.
The following example shows how to obtain a
Gdk.Texture. It uses GlyGtk4 for this.```c #include <glycin-gtk4.h>
file =
Gio.File.new_for_path(“test.png”); loader =Gly.Loader.new(file); image =Gly.Loader.load(loader,None); if (image) { frame =Gly.Image.next_frame(image,None); if (frame) { texture = gly_gtk_frame_get_texture (frame); g_print (“Image height: %d\n”, gdk_texture_get_height (texture)); image_widget = gtk_image_new_from_paintable (GDK_PAINTABLE (texture)); } } ```Added in version 2.0.
- classmethod get_mime_types()¶
- Returns:
List of supported MIME types
- Return type:
[
str]
Returns a list of MIME types currently supported for loading images.
This list is generated from the config on first use of a loader or call of this function and cached afterwards. Hence, the first call can be blocking.
Added in version 2.0.
- classmethod get_mime_types_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone)callback (
Gio.AsyncReadyCallbackorNone)
Async variant of [func`Loader`.get_mime_types]
Added in version 2.0.
- classmethod get_mime_types_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – AGAsyncResult- Raises:
- Returns:
Mime types.
- Return type:
[
str]
Finishes the [func`Loader`.get_mime_types_async] call.
Added in version 2.0.
- classmethod new(file)¶
- Parameters:
file (
Gio.File) – A file from which to load the image data- Returns:
a new [class`Loader`]
- Return type:
Creates a new loader for a file.
Added in version 2.0.
- classmethod new_for_bytes(bytes)¶
- Parameters:
bytes (
GLib.Bytes) – Data from which to load the image- Returns:
a new [class`Loader`]
- Return type:
Creates a new loader for bytes.
Added in version 2.0.
- classmethod new_for_stream(stream)¶
- Parameters:
stream (
Gio.InputStream) – A stream from which to load the image data- Returns:
a new [class`Loader`]
- Return type:
Creates a new loader for a stream.
Added in version 2.0.
- load()¶
- Raises:
- Returns:
a new [class`Image`] on success, or
NULLwith error filled in- Return type:
Synchronously loads an image and returns an [class`Image`] when successful.
Added in version 2.0.
- load_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – A [class`Gio`.Cancellable] to cancel the operationcallback (
Gio.AsyncReadyCallbackorNone) – A callback to call when the operation is complete
Asynchronous version of [method`Loader`.load].
Added in version 2.0.
- load_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – AGAsyncResult- Raises:
- Returns:
Loaded image.
- Return type:
Finishes the [method`Loader`.load_async] call.
Added in version 2.0.
- set_accepted_memory_formats(memory_format_selection)¶
- Parameters:
memory_format_selection (
Gly.MemoryFormatSelection) – Accepted memory formats
Sets which memory formats can be returned by the loader
If the memory format doesn’t match one of the selected formats, the format will be transformed into the best suitable format selected.
Added in version 2.0.
- set_apply_transformations(apply_transformations)¶
- Parameters:
apply_transformations (
bool)
Set whether to apply transformations to texture
When enabled, transformations like image orientation are applied to the texture data.
This option is enabled by default.
Added in version 2.0.
- set_sandbox_selector(sandbox_selector)¶
- Parameters:
sandbox_selector (
Gly.SandboxSelector) – Method by which the sandbox mechanism is selected
Selects which sandbox mechanism should be used. The default without calling this function is [enum`SandboxSelector`]``.AUTO``.
Added in version 2.0.
Property Details¶
- Gly.Loader.props.apply_transformation¶
- Gly.Loader.props.bytes¶
- Name:
bytes- Type:
- Default Value:
- Flags:
- Gly.Loader.props.cancellable¶
- Name:
cancellable- Type:
- Default Value:
- Flags:
- Gly.Loader.props.file¶
- Name:
file- Type:
- Default Value:
- Flags:
- Gly.Loader.props.memory_format_selection¶
- Name:
memory-format-selection- Type:
- Default Value:
0- Flags:
- Gly.Loader.props.sandbox_selector¶
- Name:
sandbox-selector- Type:
- Default Value:
- Flags:
- Gly.Loader.props.stream¶
- Name:
stream- Type:
- Default Value:
- Flags: