Loading...
Searching...
No Matches
mypaint-tiled-surface.h
Go to the documentation of this file.
#ifndef MYPAINTTILEDSURFACE_H
#define MYPAINTTILEDSURFACE_H
#include <stdint.h>
#include "mypaint-surface.h"
#include "mypaint-symmetry.h"
#include "mypaint-config.h"
G_BEGIN_DECLS
typedef struct MyPaintTiledSurface MyPaintTiledSurface;
typedef struct MyPaintTiledSurface2 MyPaintTiledSurface2;
typedef struct {
int tx;
int ty;
gboolean readonly;
guint16 *buffer;
gpointer context; /* Only to be used by the surface implementations. */
int thread_id;
int mipmap_level;
} MyPaintTileRequest;
void
mypaint_tile_request_init(MyPaintTileRequest *data, int level,
int tx, int ty, gboolean readonly);
typedef void (*MyPaintTileRequestStartFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request);
typedef void (*MyPaintTileRequestEndFunction) (MyPaintTiledSurface *self, MyPaintTileRequest *request);
struct MyPaintTiledSurface {
MyPaintSurface parent;
/* "private": */
MyPaintTileRequestStartFunction tile_request_start;
MyPaintTileRequestEndFunction tile_request_end;
gboolean surface_do_symmetry;
float surface_center_x;
struct OperationQueue *operation_queue;
MyPaintRectangle dirty_bbox;
gboolean threadsafe_tile_requests;
int tile_size;
};
void
mypaint_tiled_surface_init(MyPaintTiledSurface *self,
MyPaintTileRequestStartFunction tile_request_start,
MyPaintTileRequestEndFunction tile_request_end);
void
mypaint_tiled_surface_destroy(MyPaintTiledSurface *self);
void
mypaint_tiled_surface_set_symmetry_state(MyPaintTiledSurface *self, gboolean active, float center_x);
float
mypaint_tiled_surface_get_alpha (MyPaintTiledSurface *self, float x, float y, float radius);
void mypaint_tiled_surface_tile_request_start(MyPaintTiledSurface *self, MyPaintTileRequest *request);
void mypaint_tiled_surface_tile_request_end(MyPaintTiledSurface *self, MyPaintTileRequest *request);
void mypaint_tiled_surface_begin_atomic(MyPaintTiledSurface *self);
void mypaint_tiled_surface_end_atomic(MyPaintTiledSurface *self, MyPaintRectangle *roi);
/* -- Extended interface -- */
typedef void (*MyPaintTileRequestStartFunction2) (MyPaintTiledSurface2 *self, MyPaintTileRequest *request);
typedef void (*MyPaintTileRequestEndFunction2) (MyPaintTiledSurface2 *self, MyPaintTileRequest *request);
struct MyPaintTiledSurface2 {
MyPaintSurface2 parent;
MyPaintTileRequestStartFunction2 tile_request_start;
MyPaintTileRequestEndFunction2 tile_request_end;
struct OperationQueue *operation_queue;
gboolean threadsafe_tile_requests;
int tile_size;
MyPaintSymmetryData symmetry_data;
int num_bboxes;
int num_bboxes_dirtied;
MyPaintRectangle* bboxes;
};
void
mypaint_tiled_surface2_init(
MyPaintTiledSurface2 *self,
MyPaintTileRequestStartFunction2 tile_request_start,
MyPaintTileRequestEndFunction2 tile_request_end
);
void mypaint_tiled_surface2_begin_atomic(MyPaintTiledSurface2 *self);
void mypaint_tiled_surface2_end_atomic(MyPaintTiledSurface2 *self, MyPaintRectangles *roi);
void mypaint_tiled_surface2_tile_request_start(MyPaintTiledSurface2 *self, MyPaintTileRequest *request);
void mypaint_tiled_surface2_tile_request_end(MyPaintTiledSurface2 *self, MyPaintTileRequest *request);
void
mypaint_tiled_surface2_destroy(MyPaintTiledSurface2 *self);
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);
G_END_DECLS
#endif // MYPAINTTILEDSURFACE_H
mypaint-config.h
guint16
unsigned short guint16
Definition mypaint-glib-compat.h:28
gboolean
gint gboolean
Definition mypaint-glib-compat.h:25
G_END_DECLS
#define G_END_DECLS
Definition mypaint-glib-compat.h:14
G_BEGIN_DECLS
#define G_BEGIN_DECLS
Definition mypaint-glib-compat.h:13
gpointer
void * gpointer
Definition mypaint-glib-compat.h:20
mypaint-surface.h
mypaint-symmetry.h
MyPaintSymmetryType
MyPaintSymmetryType
Enumeration of different kinds of symmetry.
Definition mypaint-symmetry.h:27
mypaint_tiled_surface_end_atomic
void mypaint_tiled_surface_end_atomic(MyPaintTiledSurface *self, MyPaintRectangle *roi)
MyPaintRectangle
Representation of a rectangle, integer values: (x, y, w, h).
Definition mypaint-rectangle.h:33
MyPaintRectangles
Holds the size and location of a MyPaintRectangle array.
Definition mypaint-rectangle.h:51
MyPaintSurface2
Extends MyPaintSurface with support for spectral ops and multiple bounding boxes.
Definition mypaint-surface.h:321
MyPaintSurface
Abstract surface type for the MyPaint brush engine.
Definition mypaint-surface.h:131
MyPaintSymmetryData
Contains data used for symmetry calculations.
Definition mypaint-symmetry.h:99
MyPaintTileRequest
Tile request used by MyPaintTiledSurface and MyPaintTiledSurface2.
Definition mypaint-tiled-surface.h:22
MyPaintTileRequest::mipmap_level
int mipmap_level
The mipmap level for which to fetch the tile (unused).
Definition mypaint-tiled-surface.h:36
MyPaintTileRequest::mypaint_tile_request_init
void mypaint_tile_request_init(MyPaintTileRequest *data, int level, int tx, int ty, gboolean readonly)
Initiatilze a tile request.
MyPaintTileRequest::thread_id
int thread_id
Identifier of the thread from which the request is made.
Definition mypaint-tiled-surface.h:34
MyPaintTileRequest::readonly
gboolean readonly
Whether the tile data should be considered read-only.
Definition mypaint-tiled-surface.h:28
MyPaintTileRequest::tx
int tx
The x-coordinate of the requested tile.
Definition mypaint-tiled-surface.h:24
MyPaintTileRequest::context
gpointer context
Additional data to be used by surface implementations (unused).
Definition mypaint-tiled-surface.h:32
MyPaintTileRequest::buffer
guint16 * buffer
Pointer to the tile buffer, set by receiver of the request.
Definition mypaint-tiled-surface.h:30
MyPaintTileRequest::ty
int ty
The y-coordinate of the requested tile.
Definition mypaint-tiled-surface.h:26
MyPaintTiledSurface2
Tile-backed implementation of MyPaintSurface2.
Definition mypaint-tiled-surface.h:205
MyPaintTiledSurface2::mypaint_tiled_surface2_destroy
void mypaint_tiled_surface2_destroy(MyPaintTiledSurface2 *self)
Deallocate all resources used by the surface struct, and the struct itself.
MyPaintTiledSurface2::mypaint_tiled_surface2_tile_request_start
void mypaint_tiled_surface2_tile_request_start(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Finalize any pending dab operations and set the resulting invalidation rectangles.
MyPaintTiledSurface2::tile_size
int tile_size
Definition mypaint-tiled-surface.h:216
MyPaintTiledSurface2::operation_queue
struct OperationQueue * operation_queue
Per-tile queue of pending dab operations.
Definition mypaint-tiled-surface.h:213
MyPaintTiledSurface2::tile_request_end
MyPaintTileRequestEndFunction2 tile_request_end
See MyPaintTileRequestEndFunction2.
Definition mypaint-tiled-surface.h:211
MyPaintTiledSurface2::mypaint_tiled_surface2_tile_request_end
void mypaint_tiled_surface2_tile_request_end(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Finalize any pending dab operations and set the resulting invalidation rectangles.
MyPaintTiledSurface2::MyPaintTileRequestStartFunction2
void(* MyPaintTileRequestStartFunction2)(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Functionally equivalent to MyPaintTileRequestStartFunction.
Definition mypaint-tiled-surface.h:190
MyPaintTiledSurface2::parent
MyPaintSurface2 parent
Parent interface.
Definition mypaint-tiled-surface.h:207
MyPaintTiledSurface2::threadsafe_tile_requests
gboolean threadsafe_tile_requests
Whether tile requests shuold be considered thread-safe or not.
Definition mypaint-tiled-surface.h:215
MyPaintTiledSurface2::num_bboxes_dirtied
int num_bboxes_dirtied
The number of bboxes that have been modified since they were last reset.
Definition mypaint-tiled-surface.h:225
MyPaintTiledSurface2::MyPaintTileRequestEndFunction2
void(* MyPaintTileRequestEndFunction2)(MyPaintTiledSurface2 *self, MyPaintTileRequest *request)
Functionally equivalent to MyPaintTileRequestEndFunction.
Definition mypaint-tiled-surface.h:194
MyPaintTiledSurface2::mypaint_tiled_surface2_end_atomic
void mypaint_tiled_surface2_end_atomic(MyPaintTiledSurface2 *self, MyPaintRectangles *roi)
Finalize any pending dab operations and set the resulting invalidation rectangles.
MyPaintTiledSurface2::bboxes
MyPaintRectangle * bboxes
Pointer to an array of invalidation rectangles.
Definition mypaint-tiled-surface.h:230
MyPaintTiledSurface2::symmetry_data
MyPaintSymmetryData symmetry_data
The symmetry data used.
Definition mypaint-tiled-surface.h:221
MyPaintTiledSurface2::tile_request_start
MyPaintTileRequestStartFunction2 tile_request_start
See MyPaintTileRequestStartFunction2.
Definition mypaint-tiled-surface.h:209
MyPaintTiledSurface2::num_bboxes
int num_bboxes
Length of bboxes.
Definition mypaint-tiled-surface.h:223
MyPaintTiledSurface2::mypaint_tiled_surface2_set_symmetry_state
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.
MyPaintTiledSurface2::mypaint_tiled_surface2_begin_atomic
void mypaint_tiled_surface2_begin_atomic(MyPaintTiledSurface2 *self)
Prepare the surface for handling a set of dab operations.
MyPaintTiledSurface2::mypaint_tiled_surface2_init
void mypaint_tiled_surface2_init(MyPaintTiledSurface2 *self, MyPaintTileRequestStartFunction2 tile_request_start, MyPaintTileRequestEndFunction2 tile_request_end)
Initialize the surface by providing the tile request implementations.
MyPaintTiledSurface
Tile-backed implementation of MyPaintSurface.
Definition mypaint-tiled-surface.h:75
MyPaintTiledSurface::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.
MyPaintTiledSurface::dirty_bbox
MyPaintRectangle dirty_bbox
Invalidation rectangle recording areas changed between the calls to parent's MyPaintSurface::begin_at...
Definition mypaint-tiled-surface.h:93
MyPaintTiledSurface::operation_queue
struct OperationQueue * operation_queue
Per-tile queue of pending dab operations.
Definition mypaint-tiled-surface.h:88
MyPaintTiledSurface::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.
MyPaintTiledSurface::surface_do_symmetry
gboolean surface_do_symmetry
Whether vertical-line symmetry is enabled or not.
Definition mypaint-tiled-surface.h:84
MyPaintTiledSurface::MyPaintTileRequestEndFunction
void(* MyPaintTileRequestEndFunction)(MyPaintTiledSurface *self, MyPaintTileRequest *request)
Function for ending a tile request from the surface backend.
Definition mypaint-tiled-surface.h:62
MyPaintTiledSurface::tile_request_end
MyPaintTileRequestEndFunction tile_request_end
See MyPaintTileRequestEndFunction.
Definition mypaint-tiled-surface.h:82
MyPaintTiledSurface::surface_center_x
float surface_center_x
The x-coordinate of the vertical symmetry line.
Definition mypaint-tiled-surface.h:86
MyPaintTiledSurface::threadsafe_tile_requests
gboolean threadsafe_tile_requests
Whether tile requests shuold be considered thread-safe or not.
Definition mypaint-tiled-surface.h:95
MyPaintTiledSurface::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.
MyPaintTiledSurface::MyPaintTileRequestStartFunction
void(* MyPaintTileRequestStartFunction)(MyPaintTiledSurface *self, MyPaintTileRequest *request)
Function for beginning a tile request from the surface backend.
Definition mypaint-tiled-surface.h:54
MyPaintTiledSurface::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 MyPaintTiledSurfac...
MyPaintTiledSurface::tile_request_start
MyPaintTileRequestStartFunction tile_request_start
See MyPaintTileRequestStartFunction.
Definition mypaint-tiled-surface.h:80
MyPaintTiledSurface::tile_size
int tile_size
The side length of the (square) tiles.
Definition mypaint-tiled-surface.h:97
MyPaintTiledSurface::parent
MyPaintSurface parent
Surface interface.
Definition mypaint-tiled-surface.h:77
MyPaintTiledSurface::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.
MyPaintTiledSurface::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.
MyPaintTiledSurface::mypaint_tiled_surface_destroy
void mypaint_tiled_surface_destroy(MyPaintTiledSurface *self)
Free the resources used by the surface, and the surface itself.