Gly.Creator¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
|||
r/w |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gly.Creator(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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 fileGio.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:
- Returns:
a new [class`Creator`]
- Return type:
New in version 2.0.
- add_frame(width, height, memory_format, texture)¶
- Parameters:
width (
int) –height (
int) –memory_format (
Gly.MemoryFormat) –texture (
GLib.Bytes) – Texture data
- Raises:
- Returns:
a new [class`NewFrame`]
- Return type:
New in version 2.0.
- add_frame_with_stride(width, height, stride, memory_format, texture)¶
- Parameters:
width (
int) –height (
int) – stridestride (
int) –memory_format (
Gly.MemoryFormat) –texture (
GLib.Bytes) – Texture data
- Raises:
- Returns:
a new [class`NewFrame`]
- Return type:
New in version 2.0.
- add_metadata_key_value(key, value)¶
- Parameters:
- Returns:
TRUEif format supports key-value storage.- Return type:
Add metadata that are stored as key-value pairs. A prominent example are PNG’s
tEXtchunks.If an entry with
keyalready exists, it will be replaced.New in version 2.0.
- create()¶
- Raises:
- Returns:
The encoded image.
- Return type:
New in version 2.0.
- create_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`Creator`.create].
New in version 2.0.
- create_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – AGAsyncResult- Raises:
- Returns:
Encoded image.
- Return type:
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:
TRUEif the format supports compression setting.- Return type:
New in version 2.0.
- set_encoding_quality(quality)¶
- Parameters:
quality (
int) – Value between 0 and 100- Returns:
TRUEif format supports a quality setting.- Return type:
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:
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:
- Default Value:
- Flags:
- Gly.Creator.props.sandbox_selector¶
- Name:
sandbox-selector- Type:
- Default Value:
- Flags: