Gly.Creator

g GObject.Object GObject.Object Gly.Creator Gly.Creator GObject.Object->Gly.Creator

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (mime_type)

add_frame (width, height, memory_format, texture)

add_frame_with_stride (width, height, stride, memory_format, texture)

add_metadata_key_value (key, value)

create ()

create_async (cancellable, callback, *user_data)

create_finish (result)

set_encoding_compression (compression)

set_encoding_quality (quality)

set_sandbox_selector (sandbox_selector)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

mime-type

str

r/w/co

sandbox-selector

Gly.SandboxSelector

r/w

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gly.Creator(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gly.CreatorClass

Image creator

```c #include <glycin.h>

Gly.Creator *creator = Gly.Creator.new(“image/jpeg”, None);

if (!creator) return;

// Create frame with a single red pixel guint8 data[] = {255, 0, 0}; gsize length = sizeof(data); GLib.Bytes *texture = GLib.Bytes.new(data, length); Gly.NewFrame *new_frame = Gly.Creator.add_frame(creator, 1, 1, Gly.MemoryFormat.R8G8B8, texture);

// Create JPEG Gly.EncodedImage *encoded_image = Gly.Creator.create(creator, None);

if (encoded_image) { GLib.Bytes *binary_data = Gly.EncodedImage.get_data(encoded_image); if (binary_data) { // Write image to file Gio.File *file = Gio.File.new_for_path(“test.jpg”); Gio.File.replace_contents( file, GLib.Bytes.get_data(binary_data, None), GLib.Bytes.get_size(binary_data), None, False, Gio.FileCreateFlags.NONE, None, None, None); } } ```

New in version 2.0.

classmethod new(mime_type)
Parameters:

mime_type (str) – A null-terminated string.

Raises:

GLib.Error

Returns:

a new [class`Creator`]

Return type:

Gly.Creator

New in version 2.0.

add_frame(width, height, memory_format, texture)
Parameters:
Raises:

GLib.Error

Returns:

a new [class`NewFrame`]

Return type:

Gly.NewFrame

New in version 2.0.

add_frame_with_stride(width, height, stride, memory_format, texture)
Parameters:
Raises:

GLib.Error

Returns:

a new [class`NewFrame`]

Return type:

Gly.NewFrame

New in version 2.0.

add_metadata_key_value(key, value)
Parameters:
  • key (str) – A null-terminated string.

  • value (str) – A null-terminated string.

Returns:

TRUE if format supports key-value storage.

Return type:

bool

Add metadata that are stored as key-value pairs. A prominent example are PNG’s tEXt chunks.

If an entry with key already exists, it will be replaced.

New in version 2.0.

create()
Raises:

GLib.Error

Returns:

The encoded image.

Return type:

Gly.EncodedImage or None

New in version 2.0.

create_async(cancellable, callback, *user_data)
Parameters:

Asynchronous version of [method`Creator`.create].

New in version 2.0.

create_finish(result)
Parameters:

result (Gio.AsyncResult) – A GAsyncResult

Raises:

GLib.Error

Returns:

Encoded image.

Return type:

Gly.EncodedImage

Finishes the [method`Creator`.create_async] call.

New in version 2.0.

set_encoding_compression(compression)
Parameters:

compression (int) – Value between 0 and 100

Returns:

TRUE if the format supports compression setting.

Return type:

bool

New in version 2.0.

set_encoding_quality(quality)
Parameters:

quality (int) – Value between 0 and 100

Returns:

TRUE if format supports a quality setting.

Return type:

bool

New in version 2.0.

set_sandbox_selector(sandbox_selector)
Parameters:

sandbox_selector (Gly.SandboxSelector) – Method by which the sandbox mechanism is selected

Return type:

bool

Selects which sandbox mechanism should be used. The default without calling this function is [enum`SandboxSelector`]``.AUTO``.

New in version 2.0.

Property Details

Gly.Creator.props.mime_type
Name:

mime-type

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Gly.Creator.props.sandbox_selector
Name:

sandbox-selector

Type:

Gly.SandboxSelector

Default Value:

Gly.SandboxSelector.AUTO

Flags:

READABLE, WRITABLE