libmypaint  1.6.0
mypaint-symmetry.h
Go to the documentation of this file.
1 #ifndef MYPAINTSYMMETRY_H
2 #define MYPAINTSYMMETRY_H
3 /* libmypaint - The MyPaint Brush Library
4  * Copyright (C) 2017-2019 The MyPaint Team
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #include "mypaint-matrix.h"
20 #include "mypaint-glib-compat.h"
21 
27 typedef enum {
53 
54 
65 typedef struct {
73  float center_x;
77  float center_y;
81  float angle;
86  float num_lines;
88 
99 typedef struct {
130 
137 
138 
150 
151 
158 
168  MyPaintSymmetryData* data, gboolean active, float center_x, float center_y,
169  float symmetry_angle, MyPaintSymmetryType symmetry_type, int rot_symmetry_lines);
170 
171 #endif
gint gboolean
Definition: mypaint-glib-compat.h:25
MyPaintSymmetryType
Enumeration of different kinds of symmetry.
Definition: mypaint-symmetry.h:27
@ MYPAINT_SYMMETRY_TYPE_SNOWFLAKE
rotational symmetry and its reflection
Definition: mypaint-symmetry.h:47
@ MYPAINT_SYMMETRY_TYPES_COUNT
number of available symmetry types (only use to enumerate)
Definition: mypaint-symmetry.h:51
@ MYPAINT_SYMMETRY_TYPE_ROTATIONAL
rotational symmetry
Definition: mypaint-symmetry.h:43
@ MYPAINT_SYMMETRY_TYPE_VERTICAL
reflection across the (vertical) y-axis
Definition: mypaint-symmetry.h:31
@ MYPAINT_SYMMETRY_TYPE_HORIZONTAL
reflection across the (horizontal) x-axis
Definition: mypaint-symmetry.h:35
@ MYPAINT_SYMMETRY_TYPE_VERTHORZ
reflection across both the x-axis and the y-axis
Definition: mypaint-symmetry.h:39
Contains data used for symmetry calculations.
Definition: mypaint-symmetry.h:99
void mypaint_update_symmetry_state(MyPaintSymmetryData *const symmetry_data)
If necessary, recalculate symmetry_matrices.
MyPaintSymmetryState state_pending
The pending symmetry state.
Definition: mypaint-symmetry.h:110
void mypaint_symmetry_data_destroy(MyPaintSymmetryData *)
Destroy resources used by the data struct, and the struct itself.
void mypaint_symmetry_set_pending(MyPaintSymmetryData *data, gboolean active, float center_x, float center_y, float symmetry_angle, MyPaintSymmetryType symmetry_type, int rot_symmetry_lines)
Update state_pending and active and set pending_changes to TRUE.
int num_symmetry_matrices
The size of symmetry_matrices, depends on type and num_lines of state_current.
Definition: mypaint-symmetry.h:124
MyPaintTransform * symmetry_matrices
The matrices used for the actual symmetry calculations.
Definition: mypaint-symmetry.h:128
gboolean active
Whether symmetry is used or not.
Definition: mypaint-symmetry.h:120
MyPaintSymmetryState state_current
The current symmetry state.
Definition: mypaint-symmetry.h:104
gboolean pending_changes
Flag used to check if state_pending needs to be compared against state_current (does not necessarily ...
Definition: mypaint-symmetry.h:116
MyPaintSymmetryData mypaint_default_symmetry_data()
Create a default symmetry data instance.
Contains the basis for symmetry calculations.
Definition: mypaint-symmetry.h:65
MyPaintSymmetryType type
The type of symmetry to use.
Definition: mypaint-symmetry.h:69
float center_x
The x coordinate of the symmetry center.
Definition: mypaint-symmetry.h:73
float angle
The angle of the symmetry, in radians.
Definition: mypaint-symmetry.h:81
float num_lines
The number of symmetry lines to use, only relevant when type is one of MYPAINT_SYMMETRY_TYPE_ROTATION...
Definition: mypaint-symmetry.h:86
float center_y
The y coordinate of the symmetry center.
Definition: mypaint-symmetry.h:77
3x3 matrix of floats, row-major order.
Definition: mypaint-matrix.h:29