Class: Gegl::Buffer
- Inherits:
-
TileHandler
- Object
- TileSource
- TileHandler
- Gegl::Buffer
- Defined in:
- (unknown)
Class Method Summary collapse
-
.load(path) ⇒ Gegl::Buffer
Loads an existing GeglBuffer from disk, if it has previously been saved with gegl_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.
-
.open(path) ⇒ Gegl::Buffer
Open an existing on-disk GeglBuffer, this buffer is opened in a monitored state so multiple instances of gegl can share the same buffer.
-
.swap_create_file(suffix) ⇒ Gegl::filename
Generates a unique filename in the GEGL swap directory, suitable for using as swap space.
-
.swap_has_file(path) ⇒ Boolean
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.
-
.swap_remove_file(path) ⇒ nil
Removes a swap file, generated using gegl_buffer_swap_create_file(), unlinking the file, if exists.
Instance Method Summary collapse
-
#abyss ⇒ Gegl::Rectangle
Return the abyss extent of a buffer, this expands out to the parents extent in subbuffers.
-
#abyss=(abyss) ⇒ Boolean
Changes the size and position of the abyss rectangle of a buffer.
-
#abyss_height ⇒ Integer
Abyss-height.
- #abyss_height=(abyss_height) ⇒ Integer
-
#abyss_width ⇒ Integer
Abyss-width.
- #abyss_width=(abyss_width) ⇒ Integer
-
#abyss_x ⇒ Integer
Abyss-x.
- #abyss_x=(abyss_x) ⇒ Integer
-
#abyss_y ⇒ Integer
Abyss-y.
- #abyss_y=(abyss_y) ⇒ Integer
-
#add_handler(handler) ⇒ nil
Add a new tile handler in the existing chain of tile handler of a GeglBuffer.
-
#backend ⇒ Gegl::TileBackend
Backend.
- #backend=(backend) ⇒ Gegl::TileBackend
-
#clear(roi) ⇒ nil
Clears the provided rectangular region by setting all the associated memory to 0.
-
#copy(src_rect, repeat_mode, dst, dst_rect) ⇒ nil
Copy a region from source buffer to destination buffer.
-
#create_sub_buffer(extent) ⇒ Gegl::Buffer
Create a new sub GeglBuffer, that is a view on a larger buffer.
-
#dup ⇒ Gegl::Buffer
Duplicate a buffer (internally uses gegl_buffer_copy).
-
#extent ⇒ Gegl::Rectangle
Returns a pointer to a GeglRectangle structure defining the geometry of a specific GeglBuffer, this is also the default width/height of buffers passed in to gegl_buffer_set and gegl_buffer_get (with a scale of 1.0 at least).
-
#extent=(extent) ⇒ Boolean
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.
-
#flush ⇒ nil
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) ⇒ nil
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.
-
#format ⇒ GObject
Format.
- #format=(format) ⇒ GObject
-
#freeze_changed ⇒ nil
Blocks emission of the "changed" signal for buffer.
-
#get(rect, scale, format, dest, rowstride, repeat_mode) ⇒ nil
Fetch a rectangular linear buffer of pixel data from the GeglBuffer, the data is converted to the desired BablFormat, if the BablFormat stored and fetched is the same this amounts to a series of memcpy's aligned to demux the tile structure into a linear buffer.
- #get_tile(x, y, z) ⇒ Gegl::Tile
-
#height ⇒ Integer
Height.
- #height=(height) ⇒ Integer
-
#initialize(extent, backend) ⇒ Gegl::Buffer
constructor
Create a new GeglBuffer from a backend, if NULL is passed in the extent of the buffer will be inherited from the extent of the backend.
- #initialized=(initialized) ⇒ Boolean
-
#initialized? ⇒ Boolean
Initialized.
-
#introspectable_get(rect, scale, format_name, repeat_mode, data_length) ⇒ Array<Integer>
Fetch a rectangular linear buffer of pixel data from the GeglBuffer.
-
#introspectable_set(rect, format_name, src, src_length) ⇒ nil
Store a linear raster buffer into the GeglBuffer.
-
#iterator_new(roi, level, format, access_mode, abyss_policy, max_slots) ⇒ Gegl::BufferIterator
Create a new buffer iterator, this buffer will be iterated through in linear chunks, some chunks might be full tiles the coordinates, see the documentation of gegl_buffer_iterator_next for how to use it and destroy it.
-
#linear_close(linear) ⇒ nil
This function makes sure GeglBuffer and underlying code is aware of changes being made to the linear buffer.
-
#linear_open(extent, rowstride, format) ⇒ GObject
Raw direct random access to the full data of a buffer in linear memory.
-
#path ⇒ String
Path.
- #path=(path) ⇒ String
-
#pixels ⇒ Integer
Pixels.
- #pixels=(pixels) ⇒ Integer
-
#px_size ⇒ Integer
Px-size.
- #px_size=(px_size) ⇒ Integer
-
#remove_handler(handler) ⇒ nil
Remove the provided tile handler in the existing chain of tile handler of a GeglBuffer.
-
#sample(x, y, scale, dest, format, sampler_type, repeat_mode) ⇒ nil
Query interpolate pixel values at a given coordinate using a specified form of interpolation.
-
#sample_at_level(x, y, scale, dest, format, level, sampler_type, repeat_mode) ⇒ nil
Query interpolate pixel values at a given coordinate using a specified form of interpolation.
-
#sample_cleanup ⇒ nil
Clean up resources used by sampling framework of buffer.
-
#sampler_new(format, sampler_type) ⇒ Gegl::Sampler
Create a new sampler, when you are done with the sampler, g_object_unref it.
-
#sampler_new_at_level(format, sampler_type, level) ⇒ Gegl::Sampler
Create a new sampler, when you are done with the sampler, g_object_unref it.
-
#save(path, roi) ⇒ nil
Write a GeglBuffer to a file.
-
#set(rect, mipmap_level, format, src, rowstride) ⇒ nil
Store a linear raster buffer into the GeglBuffer.
-
#set_color(rect, color) ⇒ nil
Sets the region covered by rect to the specified color.
-
#set_color_from_pixel(rect, pixel, pixel_format) ⇒ nil
Sets the region covered by rect to the the provided pixel.
-
#set_pattern(rect, pattern, x_offset, y_offset) ⇒ nil
Fill a region with a repeating pattern.
-
#share_storage(buffer2) ⇒ Boolean
Checks if a pair of buffers share the same underlying tile storage.
-
#shift_x ⇒ Integer
Shift-x.
- #shift_x=(shift_x) ⇒ Integer
-
#shift_y ⇒ Integer
Shift-y.
- #shift_y=(shift_y) ⇒ Integer
-
#signal_connect(detailed_signal, c_handler, data) ⇒ Gegl::glong
This function should be used instead of g_signal_connect when connecting to the GeglBuffer::changed signal handler, GeglBuffer 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 ⇒ nil
Unblocks emission of the "changed" signal for buffer.
-
#tile_height ⇒ Integer
Tile-height.
- #tile_height=(tile_height) ⇒ Integer
-
#tile_width ⇒ Integer
Tile-width.
- #tile_width=(tile_width) ⇒ Integer
-
#width ⇒ Integer
Width.
- #width=(width) ⇒ Integer
-
#x ⇒ Integer
X.
- #x=(x) ⇒ Integer
-
#y ⇒ Integer
Y.
- #y=(y) ⇒ Integer
Methods inherited from TileHandler
#create_tile, #damage_rect, #damage_tile, #dup_tile, #get_source_tile, #lock, #source, #source=, #unlock
Constructor Details
#initialize(extent, backend) ⇒ Gegl::Buffer
Create a new GeglBuffer from a backend, if NULL is passed in the extent of the buffer will be inherited from the extent of the backend.
returns a GeglBuffer, that holds a reference to the provided backend. GeglRectangle.
Class Method Details
.load(path) ⇒ Gegl::Buffer
Loads an existing GeglBuffer from disk, if it has previously been saved with gegl_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.
.open(path) ⇒ Gegl::Buffer
Open an existing on-disk GeglBuffer, 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.
.swap_create_file(suffix) ⇒ Gegl::filename
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 when gegl_exit() is called. file path, or nil is the swap is disabled. The returned string should be freed with g_free() when no longer needed.
.swap_has_file(path) ⇒ Boolean
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.
.swap_remove_file(path) ⇒ nil
Removes a swap file, generated using gegl_buffer_swap_create_file(), unlinking the file, if exists.
Instance Method Details
#abyss ⇒ Gegl::Rectangle
Return the abyss extent of a buffer, this expands out to the parents extent in subbuffers.
#abyss=(abyss) ⇒ Boolean
Changes the size and position of the abyss rectangle of a buffer.
Returns TRUE if the change of abyss was successful.
#abyss_height ⇒ Integer
Returns abyss-height.
#abyss_height=(abyss_height) ⇒ Integer
#abyss_width ⇒ Integer
Returns abyss-width.
#abyss_width=(abyss_width) ⇒ Integer
#abyss_x ⇒ Integer
Returns abyss-x.
#abyss_x=(abyss_x) ⇒ Integer
#abyss_y ⇒ Integer
Returns abyss-y.
#abyss_y=(abyss_y) ⇒ Integer
#add_handler(handler) ⇒ nil
Add a new tile handler in the existing chain of tile handler of a GeglBuffer.
#backend ⇒ Gegl::TileBackend
Returns backend.
#backend=(backend) ⇒ Gegl::TileBackend
#clear(roi) ⇒ nil
Clears the provided rectangular region by setting all the associated memory to 0.
#copy(src_rect, repeat_mode, dst, dst_rect) ⇒ nil
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) ⇒ Gegl::Buffer
Create a new sub GeglBuffer, that is a view on a larger buffer.
#dup ⇒ Gegl::Buffer
Duplicate a buffer (internally uses gegl_buffer_copy). Aligned tiles will create copy-on-write clones in the new buffer.
#extent ⇒ Gegl::Rectangle
Returns a pointer to a GeglRectangle structure defining the geometry of a specific GeglBuffer, this is also the default width/height of buffers passed in to gegl_buffer_set and gegl_buffer_get (with a scale of 1.0 at least).
#extent=(extent) ⇒ Boolean
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.
#flush ⇒ nil
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) ⇒ nil
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.
#format ⇒ GObject
Returns format.
#format=(format) ⇒ GObject
#freeze_changed ⇒ nil
Blocks emission of the "changed" signal for buffer.
While the signal is blocked, changes to buffer are accumulated, and will be emitted once the signal is unblocked, using gegl_buffer_thaw_changed().
#get(rect, scale, format, dest, rowstride, repeat_mode) ⇒ nil
Fetch a rectangular linear buffer of pixel data from the GeglBuffer, the data is converted to the desired BablFormat, if the BablFormat stored and fetched is the same this amounts to a series of memcpy's aligned to demux the tile structure into a linear buffer. destination buffer, if NULL equal to the extent of the buffer. The coordinates and dimensions are after scale has been applied. depends on the requested BablFormat. rowstride based on the width and bytes per pixel for the specified format. 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) this argument also takes a GEGL_BUFFER_FILTER value or'ed into it, allowing to specify trade-off of performance/quality, valid values are: GEGL_BUFFER_FILTER_NEAREST, GEGL_BUFFER_FILTER_BILINEAR, GEGL_BUFFER_FILTER_BOX and GEGL_BUFFER_FILTER_AUTO.
#get_tile(x, y, z) ⇒ Gegl::Tile
#height ⇒ Integer
Returns height.
#height=(height) ⇒ Integer
#initialized=(initialized) ⇒ Boolean
#initialized? ⇒ Boolean
Returns initialized.
#introspectable_get(rect, scale, format_name, repeat_mode, data_length) ⇒ Array<Integer>
Fetch a rectangular linear buffer of pixel data from the GeglBuffer. 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).
#introspectable_set(rect, format_name, src, src_length) ⇒ nil
Store a linear raster buffer into the GeglBuffer.
#iterator_new(roi, level, format, access_mode, abyss_policy, max_slots) ⇒ Gegl::BufferIterator
Create a new buffer iterator, this buffer will be iterated through in linear chunks, some chunks might be full tiles the coordinates, see the documentation of gegl_buffer_iterator_next for how to use it and destroy it. extent at 1:1, x,y,width and height are/(2^level) buffers pixels.
#linear_close(linear) ⇒ nil
This function makes sure GeglBuffer 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).
#linear_open(extent, rowstride, format) ⇒ GObject
Raw direct random access to the full data of a buffer in linear memory. request is compatible with the underlying data storage direct access to the underlying data is provided. Otherwise, it returns a copy of the data.
#path ⇒ String
Returns path.
#path=(path) ⇒ String
#pixels ⇒ Integer
Returns pixels.
#pixels=(pixels) ⇒ Integer
#px_size ⇒ Integer
Returns px-size.
#px_size=(px_size) ⇒ Integer
#remove_handler(handler) ⇒ nil
Remove the provided tile handler in the existing chain of tile handler of a GeglBuffer.
#sample(x, y, scale, dest, format, sampler_type, repeat_mode) ⇒ nil
Query interpolate pixel values at a given coordinate using a specified form of interpolation.
If you intend to take multiple samples, consider using gegl_buffer_sampler_new() to create a sampler object instead, which is more efficient. gegl_sampler_compute_scale the same. to be ported from working code. Valid values: GEGL_SAMPLER_NEAREST, GEGL_SAMPLER_LINEAR, GEGL_SAMPLER_CUBIC, GEGL_SAMPLER_NOHALO and GEGL_SAMPLER_LOHALO 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).
#sample_at_level(x, y, scale, dest, format, level, sampler_type, repeat_mode) ⇒ nil
Query interpolate pixel values at a given coordinate using a specified form of interpolation.
If you intend to take multiple samples, consider using gegl_buffer_sampler_new_at_level() to create a sampler object instead, which is more efficient. gegl_sampler_compute_scale the same. to be ported from working code. Valid values: GEGL_SAMPLER_NEAREST, GEGL_SAMPLER_LINEAR, GEGL_SAMPLER_CUBIC, GEGL_SAMPLER_NOHALO and GEGL_SAMPLER_LOHALO 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).
#sample_cleanup ⇒ nil
Clean up resources used by sampling framework of buffer.
#sampler_new(format, sampler_type) ⇒ Gegl::Sampler
Create a new sampler, when you are done with the sampler, g_object_unref it.
Samplers only hold weak references to buffers, so if its buffer is freed the sampler will become invalid. to be ported from working code. Valid values: GEGL_SAMPLER_NEAREST, GEGL_SAMPLER_LINEAR, GEGL_SAMPLER_CUBIC, GEGL_SAMPLER_NOHALO and GEGL_SAMPLER_LOHALO
#sampler_new_at_level(format, sampler_type, level) ⇒ Gegl::Sampler
Create a new sampler, when you are done with the sampler, g_object_unref it.
Samplers only hold weak references to buffers, so if its buffer is freed the sampler will become invalid. to be ported from working code. Valid values: GEGL_SAMPLER_NEAREST, GEGL_SAMPLER_LINEAR, GEGL_SAMPLER_CUBIC, GEGL_SAMPLER_NOHALO and GEGL_SAMPLER_LOHALO
#save(path, roi) ⇒ nil
Write a GeglBuffer to a file. written to disk.
#set(rect, mipmap_level, format, src, rowstride) ⇒ nil
Store a linear raster buffer into the GeglBuffer. the linear buffer being set. the data when setting. 1 = 1:2, 2=1:4, 3=1:8 .. rowstride based on the width and bytes per pixel for the specified format.
#set_color(rect, color) ⇒ nil
Sets the region covered by rect to the specified color.
#set_color_from_pixel(rect, pixel, pixel_format) ⇒ nil
Sets the region covered by rect to the the provided pixel.
#set_pattern(rect, pattern, x_offset, y_offset) ⇒ nil
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 buffer extents.
#share_storage(buffer2) ⇒ Boolean
Checks if a pair of buffers share the same underlying tile storage.
Returns TRUE if buffer1 and buffer2 share the same storage.
#shift_x ⇒ Integer
Returns shift-x.
#shift_x=(shift_x) ⇒ Integer
#shift_y ⇒ Integer
Returns shift-y.
#shift_y=(shift_y) ⇒ Integer
#signal_connect(detailed_signal, c_handler, data) ⇒ Gegl::glong
This function should be used instead of g_signal_connect when connecting to the GeglBuffer::changed signal handler, GeglBuffer 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 ⇒ nil
Unblocks emission of the "changed" signal for buffer.
Once all calls to gegl_buffer_freeze_changed() are matched by corresponding calls to gegl_buffer_freeze_changed(), all accumulated changes are emitted.
#tile_height ⇒ Integer
Returns tile-height.
#tile_height=(tile_height) ⇒ Integer
#tile_width ⇒ Integer
Returns tile-width.
#tile_width=(tile_width) ⇒ Integer
#width ⇒ Integer
Returns width.
#width=(width) ⇒ Integer
#x ⇒ Integer
Returns x.
#x=(x) ⇒ Integer
#y ⇒ Integer
Returns y.