libmypaint
1.6.0
|
Tile-backed implementation of MyPaintSurface. More...
#include <mypaint-tiled-surface.h>
Public Types | |
typedef void(* | MyPaintTileRequestStartFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request) |
Function for beginning a tile request from the surface backend. More... | |
typedef void(* | MyPaintTileRequestEndFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request) |
Function for ending a tile request from the surface backend. More... | |
Public Member Functions | |
void | mypaint_tiled_surface_init (MyPaintTiledSurface *self, MyPaintTileRequestStartFunction tile_request_start, MyPaintTileRequestEndFunction tile_request_end) |
Initialize the surface by providing the tile request implementations. More... | |
void | mypaint_tiled_surface_destroy (MyPaintTiledSurface *self) |
Free the resources used by the surface, and the surface itself. More... | |
void | mypaint_tiled_surface_set_symmetry_state (MyPaintTiledSurface *self, gboolean active, float center_x) |
Set the symmetry state of the surface. More... | |
float | mypaint_tiled_surface_get_alpha (MyPaintTiledSurface *self, float x, float y, float radius) |
Get the average alpha value of pixels covered by a standard dab. More... | |
void | mypaint_tiled_surface_tile_request_start (MyPaintTiledSurface *self, MyPaintTileRequest *request) |
Fetch a tile out from the underlying tile store. More... | |
void | mypaint_tiled_surface_tile_request_end (MyPaintTiledSurface *self, MyPaintTileRequest *request) |
Put a (potentially modified) tile back into the underlying tile store. More... | |
void | mypaint_tiled_surface_begin_atomic (MyPaintTiledSurface *self) |
Implementation of MyPaintSurface::begin_atomic Note: Only intended to be used from MyPaintTiledSurface subclasses, which should chain up to this if overriding MyPaintSurface::begin_atomic. More... | |
Data Fields | |
MyPaintSurface | parent |
Surface interface. More... | |
MyPaintTileRequestStartFunction | tile_request_start |
See MyPaintTileRequestStartFunction. More... | |
MyPaintTileRequestEndFunction | tile_request_end |
See MyPaintTileRequestEndFunction. More... | |
gboolean | surface_do_symmetry |
Whether vertical-line symmetry is enabled or not. More... | |
float | surface_center_x |
The x-coordinate of the vertical symmetry line. More... | |
struct OperationQueue * | operation_queue |
Per-tile queue of pending dab operations. More... | |
MyPaintRectangle | dirty_bbox |
Invalidation rectangle recording areas changed between the calls to parent's MyPaintSurface::begin_atomic and MyPaintSurface::end_atomic. More... | |
gboolean | threadsafe_tile_requests |
Whether tile requests shuold be considered thread-safe or not. More... | |
int | tile_size |
The side length of the (square) tiles. More... | |
Tile-backed implementation of MyPaintSurface.
Interface and convenience class for implementing a MyPaintSurface backed by a tile store.
The size of the surface is infinite, and consumers only need to provide implementations for tile_request_start and tile_request_end
typedef void(* MyPaintTileRequestEndFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request) |
Function for ending a tile request from the surface backend.
typedef void(* MyPaintTileRequestStartFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request) |
Function for beginning a tile request from the surface backend.
void mypaint_tiled_surface_begin_atomic | ( | MyPaintTiledSurface * | self | ) |
Implementation of MyPaintSurface::begin_atomic Note: Only intended to be used from MyPaintTiledSurface subclasses, which should chain up to this if overriding MyPaintSurface::begin_atomic.
Application code should only use mypaint_surface_begin_atomic
void mypaint_tiled_surface_destroy | ( | MyPaintTiledSurface * | self | ) |
Free the resources used by the surface, and the surface itself.
Frees up the resources allocated in mypaint_tiled_surface_init.
float mypaint_tiled_surface_get_alpha | ( | MyPaintTiledSurface * | self, |
float | x, | ||
float | y, | ||
float | radius | ||
) |
Get the average alpha value of pixels covered by a standard dab.
Equivalent to mypaint_surface_get_alpha (this function should probably not have been made public).
void mypaint_tiled_surface_init | ( | MyPaintTiledSurface * | self, |
MyPaintTileRequestStartFunction | tile_request_start, | ||
MyPaintTileRequestEndFunction | tile_request_end | ||
) |
Initialize the surface by providing the tile request implementations.
Allocates the resources necessary for the surface to function.
void mypaint_tiled_surface_set_symmetry_state | ( | MyPaintTiledSurface * | self, |
gboolean | active, | ||
float | center_x | ||
) |
Set the symmetry state of the surface.
When the symmetry is active, for each dab drawn with mypaint_surface_draw_dab, reflected horizontally across the vertical line defined by MyPaintTiledSurface.surface_center_x.
active | Whether symmetry should be used or not. |
center_x | The x-coordinate of the vertical line to reflect the dabs across |
void mypaint_tiled_surface_tile_request_end | ( | MyPaintTiledSurface * | self, |
MyPaintTileRequest * | request | ||
) |
Put a (potentially modified) tile back into the underlying tile store.
Consumers must always call mypaint_tiled_surface_tile_request_start() with the same request to start the transaction before calling this function.
void mypaint_tiled_surface_tile_request_start | ( | MyPaintTiledSurface * | self, |
MyPaintTileRequest * | request | ||
) |
Fetch a tile out from the underlying tile store.
When successful, request->data will be set to point to the fetched tile. Consumers must always call mypaint_tiled_surface_tile_request_end with the same request to complete the transaction.
MyPaintRectangle MyPaintTiledSurface::dirty_bbox |
Invalidation rectangle recording areas changed between the calls to parent's MyPaintSurface::begin_atomic and MyPaintSurface::end_atomic.
struct OperationQueue* MyPaintTiledSurface::operation_queue |
Per-tile queue of pending dab operations.
MyPaintSurface MyPaintTiledSurface::parent |
Surface interface.
float MyPaintTiledSurface::surface_center_x |
The x-coordinate of the vertical symmetry line.
gboolean MyPaintTiledSurface::surface_do_symmetry |
Whether vertical-line symmetry is enabled or not.
gboolean MyPaintTiledSurface::threadsafe_tile_requests |
Whether tile requests shuold be considered thread-safe or not.
MyPaintTileRequestEndFunction MyPaintTiledSurface::tile_request_end |
MyPaintTileRequestStartFunction MyPaintTiledSurface::tile_request_start |
int MyPaintTiledSurface::tile_size |
The side length of the (square) tiles.