libmypaint  1.6.0
mypaint-tiled-surface.h
Go to the documentation of this file.
1 #ifndef MYPAINTTILEDSURFACE_H
2 #define MYPAINTTILEDSURFACE_H
3 
4 #include <stdint.h>
5 #include "mypaint-surface.h"
6 #include "mypaint-symmetry.h"
7 #include "mypaint-config.h"
8 
10 
13 
22 typedef struct {
24  int tx;
26  int ty;
32  gpointer context; /* Only to be used by the surface implementations. */
34  int thread_id;
38 
44 void
46  int tx, int ty, gboolean readonly);
47 
55 
63 
78  /* "private": */
88  struct OperationQueue *operation_queue;
97  int tile_size;
98 };
99 
108 void
110  MyPaintTileRequestStartFunction tile_request_start,
111  MyPaintTileRequestEndFunction tile_request_end);
112 
113 
122 void
124 
125 
138 void
140 
149 float
150 mypaint_tiled_surface_get_alpha (MyPaintTiledSurface *self, float x, float y, float radius);
151 
162 
172 
183 
184 
185 /* -- Extended interface -- */
186 
195 
213  struct OperationQueue *operation_queue;
231 };
232 
241 void
243  MyPaintTiledSurface2 *self,
244  MyPaintTileRequestStartFunction2 tile_request_start,
245  MyPaintTileRequestEndFunction2 tile_request_end
246  );
247 
254 
261 
268 
275 
281 void
283 
290 void
292  float center_x, float center_y,
293  float symmetry_angle,
294  MyPaintSymmetryType symmetry_type,
295  int rot_symmetry_lines);
296 
298 
299 #endif // MYPAINTTILEDSURFACE_H
unsigned short guint16
Definition: mypaint-glib-compat.h:28
gint gboolean
Definition: mypaint-glib-compat.h:25
#define G_END_DECLS
Definition: mypaint-glib-compat.h:14
#define G_BEGIN_DECLS
Definition: mypaint-glib-compat.h:13
void * gpointer
Definition: mypaint-glib-compat.h:20
MyPaintSymmetryType
Enumeration of different kinds of symmetry.
Definition: mypaint-symmetry.h:27
void mypaint_tiled_surface_end_atomic(MyPaintTiledSurface *self, MyPaintRectangle *roi)
Representation of a rectangle, integer values: (x, y, w, h)
Definition: mypaint-rectangle.h:33
Holds the size and location of a MyPaintRectangle array.
Definition: mypaint-rectangle.h:51
Extends MyPaintSurface with support for spectral ops and multiple bounding boxes.
Definition: mypaint-surface.h:321
Abstract surface type for the MyPaint brush engine.
Definition: mypaint-surface.h:131
Contains data used for symmetry calculations.
Definition: mypaint-symmetry.h:99
Tile request used by MyPaintTiledSurface and MyPaintTiledSurface2.
Definition: mypaint-tiled-surface.h:22
int mipmap_level
The mipmap level for which to fetch the tile __(unused)__.
Definition: mypaint-tiled-surface.h:36
void mypaint_tile_request_init(MyPaintTileRequest *data, int level, int tx, int ty, gboolean readonly)
Initiatilze a tile request.
int thread_id
Identifier of the thread from which the request is made.
Definition: mypaint-tiled-surface.h:34
gboolean readonly
Whether the tile data should be considered read-only.
Definition: mypaint-tiled-surface.h:28
int tx
The x-coordinate of the requested tile.
Definition: mypaint-tiled-surface.h:24
gpointer context
Additional data to be used by surface implementations __(unused)__.
Definition: mypaint-tiled-surface.h:32
guint16 * buffer
Pointer to the tile buffer, set by receiver of the request.
Definition: mypaint-tiled-surface.h:30
int ty
The y-coordinate of the requested tile.
Definition: mypaint-tiled-surface.h:26
Tile-backed implementation of MyPaintSurface2.
Definition: mypaint-tiled-surface.h:205
void mypaint_tiled_surface2_destroy(MyPaintTiledSurface2 *self)
Deallocate all resources used by the surface struct, and the struct itself.
void mypaint_tiled_surface2_tile_request_start(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Finalize any pending dab operations and set the resulting invalidation rectangles.
int tile_size
Definition: mypaint-tiled-surface.h:216
struct OperationQueue * operation_queue
Per-tile queue of pending dab operations.
Definition: mypaint-tiled-surface.h:213
MyPaintTileRequestEndFunction2 tile_request_end
See MyPaintTileRequestEndFunction2.
Definition: mypaint-tiled-surface.h:211
void mypaint_tiled_surface2_tile_request_end(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Finalize any pending dab operations and set the resulting invalidation rectangles.
void(* MyPaintTileRequestStartFunction2)(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Functionally equivalent to MyPaintTileRequestStartFunction.
Definition: mypaint-tiled-surface.h:190
MyPaintSurface2 parent
Parent interface.
Definition: mypaint-tiled-surface.h:207
gboolean threadsafe_tile_requests
Whether tile requests shuold be considered thread-safe or not.
Definition: mypaint-tiled-surface.h:215
int num_bboxes_dirtied
The number of bboxes that have been modified since they were last reset.
Definition: mypaint-tiled-surface.h:225
void(* MyPaintTileRequestEndFunction2)(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Functionally equivalent to MyPaintTileRequestEndFunction.
Definition: mypaint-tiled-surface.h:194
void mypaint_tiled_surface2_end_atomic(MyPaintTiledSurface2 *self, MyPaintRectangles *roi)
Finalize any pending dab operations and set the resulting invalidation rectangles.
MyPaintRectangle * bboxes
Pointer to an array of invalidation rectangles.
Definition: mypaint-tiled-surface.h:230
MyPaintSymmetryData symmetry_data
The symmetry data used.
Definition: mypaint-tiled-surface.h:221
MyPaintTileRequestStartFunction2 tile_request_start
See MyPaintTileRequestStartFunction2.
Definition: mypaint-tiled-surface.h:209
int num_bboxes
Length of bboxes.
Definition: mypaint-tiled-surface.h:223
void mypaint_tiled_surface2_set_symmetry_state(MyPaintTiledSurface2 *self, gboolean active, float center_x, float center_y, float symmetry_angle, MyPaintSymmetryType symmetry_type, int rot_symmetry_lines)
Set new symmetry_data values and mark it for update.
void mypaint_tiled_surface2_begin_atomic(MyPaintTiledSurface2 *self)
Prepare the surface for handling a set of dab operations.
void mypaint_tiled_surface2_init(MyPaintTiledSurface2 *self, MyPaintTileRequestStartFunction2 tile_request_start, MyPaintTileRequestEndFunction2 tile_request_end)
Initialize the surface by providing the tile request implementations.
Tile-backed implementation of MyPaintSurface.
Definition: mypaint-tiled-surface.h:75
void mypaint_tiled_surface_init(MyPaintTiledSurface *self, MyPaintTileRequestStartFunction tile_request_start, MyPaintTileRequestEndFunction tile_request_end)
Initialize the surface by providing the tile request implementations.
MyPaintRectangle dirty_bbox
Invalidation rectangle recording areas changed between the calls to parent's MyPaintSurface::begin_at...
Definition: mypaint-tiled-surface.h:93
struct OperationQueue * operation_queue
Per-tile queue of pending dab operations.
Definition: mypaint-tiled-surface.h:88
void mypaint_tiled_surface_set_symmetry_state(MyPaintTiledSurface *self, gboolean active, float center_x)
Set the symmetry state of the surface.
gboolean surface_do_symmetry
Whether vertical-line symmetry is enabled or not.
Definition: mypaint-tiled-surface.h:84
void(* MyPaintTileRequestEndFunction)(MyPaintTiledSurface *self, MyPaintTileRequest *request)
Function for ending a tile request from the surface backend.
Definition: mypaint-tiled-surface.h:62
MyPaintTileRequestEndFunction tile_request_end
See MyPaintTileRequestEndFunction.
Definition: mypaint-tiled-surface.h:82
float surface_center_x
The x-coordinate of the vertical symmetry line.
Definition: mypaint-tiled-surface.h:86
gboolean threadsafe_tile_requests
Whether tile requests shuold be considered thread-safe or not.
Definition: mypaint-tiled-surface.h:95
void mypaint_tiled_surface_tile_request_end(MyPaintTiledSurface *self, MyPaintTileRequest *request)
Put a (potentially modified) tile back into the underlying tile store.
void(* MyPaintTileRequestStartFunction)(MyPaintTiledSurface *self, MyPaintTileRequest *request)
Function for beginning a tile request from the surface backend.
Definition: mypaint-tiled-surface.h:54
void mypaint_tiled_surface_begin_atomic(MyPaintTiledSurface *self)
Implementation of MyPaintSurface::begin_atomic Note: Only intended to be used from MyPaintTiledSurfac...
MyPaintTileRequestStartFunction tile_request_start
See MyPaintTileRequestStartFunction.
Definition: mypaint-tiled-surface.h:80
int tile_size
The side length of the (square) tiles.
Definition: mypaint-tiled-surface.h:97
MyPaintSurface parent
Surface interface.
Definition: mypaint-tiled-surface.h:77
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.
void mypaint_tiled_surface_tile_request_start(MyPaintTiledSurface *self, MyPaintTileRequest *request)
Fetch a tile out from the underlying tile store.
void mypaint_tiled_surface_destroy(MyPaintTiledSurface *self)
Free the resources used by the surface, and the surface itself.