libmypaint  1.6.0
Public Types | Public Member Functions | Data Fields
MyPaintTiledSurface Struct Reference

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...
 

Detailed Description

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

See also
MyPaintTiledSurface2

Member Typedef Documentation

◆ MyPaintTileRequestEndFunction

typedef void(* MyPaintTileRequestEndFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request)

Function for ending a tile request from the surface backend.

See also
MyPaintTileRequest, MyPaintTileRequestStartFunction

◆ MyPaintTileRequestStartFunction

typedef void(* MyPaintTileRequestStartFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request)

Function for beginning a tile request from the surface backend.

See also
MyPaintTileRequest, MyPaintTileRequestEndFunction

Member Function Documentation

◆ mypaint_tiled_surface_begin_atomic()

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

◆ mypaint_tiled_surface_destroy()

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.

See also
mypaint_tiled_surface_init

◆ mypaint_tiled_surface_get_alpha()

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).

◆ mypaint_tiled_surface_init()

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.

See also
mypaint_tiled_surface_destroy

◆ mypaint_tiled_surface_set_symmetry_state()

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.

Parameters
activeWhether symmetry should be used or not.
center_xThe x-coordinate of the vertical line to reflect the dabs across

◆ mypaint_tiled_surface_tile_request_end()

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.

◆ mypaint_tiled_surface_tile_request_start()

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.

Field Documentation

◆ dirty_bbox

MyPaintRectangle MyPaintTiledSurface::dirty_bbox

Invalidation rectangle recording areas changed between the calls to parent's MyPaintSurface::begin_atomic and MyPaintSurface::end_atomic.

◆ operation_queue

struct OperationQueue* MyPaintTiledSurface::operation_queue

Per-tile queue of pending dab operations.

◆ parent

MyPaintSurface MyPaintTiledSurface::parent

Surface interface.

◆ surface_center_x

float MyPaintTiledSurface::surface_center_x

The x-coordinate of the vertical symmetry line.

◆ surface_do_symmetry

gboolean MyPaintTiledSurface::surface_do_symmetry

Whether vertical-line symmetry is enabled or not.

◆ threadsafe_tile_requests

gboolean MyPaintTiledSurface::threadsafe_tile_requests

Whether tile requests shuold be considered thread-safe or not.

◆ tile_request_end

MyPaintTileRequestEndFunction MyPaintTiledSurface::tile_request_end

◆ tile_request_start

MyPaintTileRequestStartFunction MyPaintTiledSurface::tile_request_start

◆ tile_size

int MyPaintTiledSurface::tile_size

The side length of the (square) tiles.


The documentation for this struct was generated from the following file: