Gegl.Buffer¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
pixel height of abyss |
||
r/w/co |
pixel width of abyss |
||
r/w/co |
|||
r/w/co |
|||
r/w/co |
A custom tile-backend instance to use |
||
r/w/c |
babl format |
||
r/w/c |
pixel height of buffer |
||
r/w/co |
|||
r/w/co |
URI to where the buffer is stored |
||
r |
total amount of pixels in image (width x height) |
||
r |
size of a single pixel in bytes. |
||
r/w/co |
|||
r/w/co |
|||
r/w/co |
height of a tile |
||
r/w/co |
width of a tile |
||
r/w/c |
pixel width of buffer |
||
r/w/c |
local origin’s offset relative to source origin |
||
r/w/c |
local origin’s offset relative to source origin |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Fields¶
- Inherited:
Class Details¶
- class Gegl.Buffer(**kwargs)¶
- Bases:
- Abstract:
No
- classmethod load(path)¶
- Parameters:
path (
str
) – the path to a gegl buffer on disk.- Returns:
a
Gegl.Buffer
object.- Return type:
Loads an existing
Gegl.Buffer
from disk, if it has previously been saved withGegl.Buffer.save
it should be possible to open through any GIO transport, buffers that have been used as swap needs random access to be opened.
- classmethod new(format_name, x, y, width, height)¶
- Parameters:
- Return type:
Create a new
Gegl.Buffer
with the given format and dimensions.
- classmethod new_for_backend(extent, backend)¶
- Parameters:
extent (
Gegl.Rectangle
) – the geometry of the buffer (origin, width and height) aGegl.Rectangle
.backend (
Gegl.TileBackend
) – an instance of aGegl.TileBackend
subclass.
- Return type:
Create a new
Gegl.Buffer
from a backend, ifNone
is passed in the extent of the buffer will be inherited from the extent of the backend.returns a
Gegl.Buffer
, that holds a reference to the provided backend.
- classmethod open(path)¶
- Parameters:
path (
str
) – the path to a gegl buffer on disk.- Returns:
a
Gegl.Buffer
object.- Return type:
Open an existing on-disk
Gegl.Buffer
, this buffer is opened in a monitored state so multiple instances of gegl can share the same buffer. Sets on one buffer are reflected in the other.
- classmethod swap_create_file(suffix)¶
- Parameters:
suffix (
str
orNone
) – a string to suffix the filename with, for identification purposes, orNone
.- Returns:
a string containing the full file path, or
None
is the swap is disabled. The returned string should be freed withGLib.free
() when no longer needed.- Return type:
Generates a unique filename in the GEGL swap directory, suitable for using as swap space. When the file is no longer needed, it may be removed with
Gegl.Buffer.swap_remove_file
(); otherwise, it will be removed whenGegl.exit
() is called.
- classmethod swap_has_file(path)¶
-
Tests if path is a swap file, that is, if it has been created with
Gegl.Buffer.swap_create_file
(), and hasn’t been removed yet.
- classmethod swap_remove_file(path)¶
- Parameters:
path (
str
) – the swap file to remove, as returned byGegl.Buffer.swap_create_file
()
Removes a swap file, generated using
Gegl.Buffer.swap_create_file
(), unlinking the file, if exists.
- add_handler(handler)¶
- Parameters:
handler (
object
orNone
) – aGegl.TileHandler
Add a new tile handler in the existing chain of tile handler of a
Gegl.Buffer
.
- clear(roi)¶
- Parameters:
roi (
Gegl.Rectangle
) – a rectangular region
Clears the provided rectangular region by setting all the associated memory to 0.
- copy(src_rect, repeat_mode, dst, dst_rect)¶
- Parameters:
src_rect (
Gegl.Rectangle
) – source rectangle (orNone
to copy entire source buffer)repeat_mode (
Gegl.AbyssPolicy
) – the abyss policy to be using if src_rect is outside src’s extent.dst (
Gegl.Buffer
) – destination buffer.dst_rect (
Gegl.Rectangle
) – position of upper left destination pixel (orNone
to match src_rect)
Copy a region from source buffer to destination buffer.
If the babl_formats of the buffers are the same, and the tile boundaries align, this will create copy-on-write tiles in the destination buffer.
This function never does any scaling. When src_rect and dst_rect do not have the same width and height, the size of src_rect is used.
- create_sub_buffer(extent)¶
- Parameters:
extent (
Gegl.Rectangle
) – coordinates of new buffer.- Returns:
the new sub buffer
- Return type:
Create a new sub
Gegl.Buffer
, that is a view on a larger buffer.
- dup()¶
- Returns:
the new buffer
- Return type:
Duplicate a buffer (internally uses
Gegl.Buffer.copy
). Aligned tiles will create copy-on-write clones in the new buffer.
- flush()¶
Flushes all unsaved data to disk, this is not necessary for shared geglbuffers opened with
Gegl.Buffer.open
since they auto-sync on writes.
- flush_ext(rect)¶
- Parameters:
rect (
Gegl.Rectangle
) – rectangle
Invokes the external flush function, if any is set on the provided buffer - this ensures that data pending - in the current implementation only OpenCL - externally to be synchronized with the buffer. Multi threaded code should call such a synchronization before branching out to avoid each of the threads having an implicit synchronization of its own.
- freeze_changed()¶
Blocks emission of the “changed” signal for self.
While the signal is blocked, changes to self are accumulated, and will be emitted once the signal is unblocked, using
Gegl.Buffer.thaw_changed
().
- get(rect, scale, format_name, repeat_mode)¶
- Parameters:
rect (
Gegl.Rectangle
) – the coordinates we want to retrieve data from.scale (
float
) – sampling scale, 1.0 = pixel for pixel 2.0 = magnify, 0.5 scale down.format_name (
str
orNone
) – the format to store data in, ifNone
the format of the buffer is used.repeat_mode (
Gegl.AbyssPolicy
) – how requests outside the buffer extent are handled. Valid values: GEGL_ABYSS_NONE (abyss pixels are zeroed), GEGL_ABYSS_WHITE (abyss pixels are white), GEGL_ABYSS_BLACK (abyss pixels are black), GEGL_ABYSS_CLAMP (coordinates are clamped to the abyss rectangle), GEGL_ABYSS_LOOP (buffer contents are tiled if outside of the abyss rectangle).
- Returns:
A copy of the requested data
- Return type:
Fetch a rectangular linear buffer of pixel data from the
Gegl.Buffer
.
- get_abyss()¶
- Return type:
Return the abyss extent of a buffer, this expands out to the parents extent in subbuffers.
- get_extent()¶
- Return type:
Returns a pointer to a
Gegl.Rectangle
structure defining the geometry of a specificGegl.Buffer
, this is also the default width/height of buffers passed in toGegl.Buffer.set
andGegl.Buffer.get
(with a scale of 1.0 at least).
- linear_close(linear)¶
-
This function makes sure
Gegl.Buffer
and underlying code is aware of changes being made to the linear buffer. If the request was not a compatible one it is written back to the buffer. Multiple concurrent users can be handed the same buffer (both raw access and converted).
- remove_handler(handler)¶
- Parameters:
handler (
object
orNone
) – aGegl.TileHandler
Remove the provided tile handler in the existing chain of tile handler of a
Gegl.Buffer
.
- sample_cleanup()¶
Clean up resources used by sampling framework of buffer.
Deprecated since version 0.4.2: This function has no effect. It is not necessary to call it after using gegl_buffer_sample() or gegl_buffer_sample_at_level().
- save(path, roi)¶
- Parameters:
path (
str
) – the path where the gegl buffer will be saved, any writable GIO uri is valid.roi (
Gegl.Rectangle
) – the region of interest to write, this is the tiles that will be collected and written to disk.
Write a
Gegl.Buffer
to a file.
- set(rect, format_name, src)¶
- Parameters:
rect (
Gegl.Rectangle
) – the rectangle to write.format_name (
str
) – the format of the input data.src (
bytes
) – pixel data to write to self.
Store a linear raster buffer into the
Gegl.Buffer
.
- set_abyss(abyss)¶
- Parameters:
abyss (
Gegl.Rectangle
) – new abyss.- Return type:
Changes the size and position of the abyss rectangle of a buffer.
Returns
True
if the change of abyss was successful.
- set_color(rect, color)¶
- Parameters:
rect (
Gegl.Rectangle
) – a rectangular region to fill with a color.color (
Gegl.Color
) – theGegl.Color
to fill with.
Sets the region covered by rect to the specified color.
- set_color_from_pixel(rect, pixel, pixel_format)¶
- Parameters:
rect (
Gegl.Rectangle
) – a rectangular region to fill with a color.pixel (
object
orNone
) – pointer to the data of a single pixelpixel_format (
Babl.Object
) – the babl format of the pixel, if missing - the soft format of dst.
Sets the region covered by rect to the the provided pixel.
- set_extent(extent)¶
- Parameters:
extent (
Gegl.Rectangle
) – new extent.- Return type:
Changes the size and position that is considered active in a buffer, this operation is valid on any buffer, reads on subbuffers outside the master buffer’s extent are at the moment undefined.
Returns
True
if the change of extent was successful.
- set_pattern(rect, pattern, x_offset, y_offset)¶
- Parameters:
rect (
Gegl.Rectangle
) – the region of self to fillpattern (
Gegl.Buffer
) – aGegl.Buffer
to be repeated as a patternx_offset (
int
) – where the pattern starts horizontallyy_offset (
int
) – where the pattern starts vertical
Fill a region with a repeating pattern. Offsets parameters are relative to the origin (0, 0) and not to the rectangle. So be carefull about the origin of pattern and self extents.
- Parameters:
buffer2 (
Gegl.Buffer
) – aGegl.Buffer
.- Return type:
Checks if a pair of buffers share the same underlying tile storage.
Returns
True
if self and buffer2 share the same storage.
- signal_connect(detailed_signal, c_handler, *data)¶
- Parameters:
detailed_signal (
str
) – only “changed” expected for nowc_handler (
GObject.Callback
) – c function callback
- Returns:
an handle like g_signal_connect.
- Return type:
This function should be used instead of g_signal_connect when connecting to the
Gegl.Buffer
::changed
signal handler,Gegl.Buffer
contains additional machinery to avoid the overhead of changes when no signal handler have been connected, if regular g_signal_connect is used; then no signals will be emitted.
- thaw_changed()¶
Unblocks emission of the “changed” signal for self.
Once all calls to
Gegl.Buffer.freeze_changed
() are matched by corresponding calls toGegl.Buffer.freeze_changed
(), all accumulated changes are emitted.
Signal Details¶
- Gegl.Buffer.signals.changed(buffer, object)¶
- Signal Name:
changed
- Flags:
- Parameters:
buffer (
Gegl.Buffer
) – The object which received the signalobject (
Gegl.Rectangle
) –
Property Details¶
- Gegl.Buffer.props.abyss_height¶
- Name:
abyss-height
- Type:
- Default Value:
0
- Flags:
pixel height of abyss
- Gegl.Buffer.props.abyss_width¶
- Name:
abyss-width
- Type:
- Default Value:
0
- Flags:
pixel width of abyss
- Gegl.Buffer.props.abyss_x¶
- Name:
abyss-x
- Type:
- Default Value:
0
- Flags:
- Gegl.Buffer.props.abyss_y¶
- Name:
abyss-y
- Type:
- Default Value:
0
- Flags:
- Gegl.Buffer.props.backend¶
- Name:
backend
- Type:
- Default Value:
- Flags:
A custom tile-backend instance to use
- Gegl.Buffer.props.format¶
-
babl format
- Gegl.Buffer.props.height¶
-
pixel height of buffer
- Gegl.Buffer.props.initialized¶
- Name:
initialized
- Type:
- Default Value:
- Flags:
- Gegl.Buffer.props.path¶
- Name:
path
- Type:
- Default Value:
- Flags:
URI to where the buffer is stored
- Gegl.Buffer.props.pixels¶
-
total amount of pixels in image (width x height)
- Gegl.Buffer.props.px_size¶
-
size of a single pixel in bytes.
- Gegl.Buffer.props.shift_x¶
- Name:
shift-x
- Type:
- Default Value:
0
- Flags:
- Gegl.Buffer.props.shift_y¶
- Name:
shift-y
- Type:
- Default Value:
0
- Flags:
- Gegl.Buffer.props.tile_height¶
- Name:
tile-height
- Type:
- Default Value:
128
- Flags:
height of a tile
- Gegl.Buffer.props.tile_width¶
- Name:
tile-width
- Type:
- Default Value:
128
- Flags:
width of a tile
- Gegl.Buffer.props.width¶
-
pixel width of buffer
- Gegl.Buffer.props.x¶
-
local origin’s offset relative to source origin