libmypaint  1.6.1
/builddir/build/BUILD/libmypaint-1.6.1/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
MYPAINT_SYMMETRY_TYPE_HORIZONTAL
@ MYPAINT_SYMMETRY_TYPE_HORIZONTAL
reflection across the (horizontal) x-axis
Definition: mypaint-symmetry.h:35
MyPaintSymmetryState::angle
float angle
The angle of the symmetry, in radians.
Definition: mypaint-symmetry.h:81
gboolean
gint gboolean
Definition: mypaint-glib-compat.h:25
mypaint-glib-compat.h
MYPAINT_SYMMETRY_TYPE_SNOWFLAKE
@ MYPAINT_SYMMETRY_TYPE_SNOWFLAKE
rotational symmetry and its reflection
Definition: mypaint-symmetry.h:47
MyPaintSymmetryData::mypaint_default_symmetry_data
MyPaintSymmetryData mypaint_default_symmetry_data()
Create a default symmetry data instance.
MyPaintSymmetryData::mypaint_update_symmetry_state
void mypaint_update_symmetry_state(MyPaintSymmetryData *const symmetry_data)
If necessary, recalculate symmetry_matrices.
MyPaintSymmetryData::state_current
MyPaintSymmetryState state_current
The current symmetry state.
Definition: mypaint-symmetry.h:104
MyPaintSymmetryData::mypaint_symmetry_set_pending
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.
MyPaintSymmetryData
Contains data used for symmetry calculations.
Definition: mypaint-symmetry.h:99
MyPaintSymmetryData::pending_changes
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
MYPAINT_SYMMETRY_TYPE_VERTICAL
@ MYPAINT_SYMMETRY_TYPE_VERTICAL
reflection across the (vertical) y-axis
Definition: mypaint-symmetry.h:31
MyPaintSymmetryData::num_symmetry_matrices
int num_symmetry_matrices
The size of symmetry_matrices, depends on type and num_lines of state_current.
Definition: mypaint-symmetry.h:124
MYPAINT_SYMMETRY_TYPE_VERTHORZ
@ MYPAINT_SYMMETRY_TYPE_VERTHORZ
reflection across both the x-axis and the y-axis
Definition: mypaint-symmetry.h:39
MyPaintSymmetryData::mypaint_symmetry_data_destroy
void mypaint_symmetry_data_destroy(MyPaintSymmetryData *)
Destroy resources used by the data struct, and the struct itself.
MyPaintSymmetryData::symmetry_matrices
MyPaintTransform * symmetry_matrices
The matrices used for the actual symmetry calculations.
Definition: mypaint-symmetry.h:128
MyPaintSymmetryState::type
MyPaintSymmetryType type
The type of symmetry to use.
Definition: mypaint-symmetry.h:69
MyPaintSymmetryState
Contains the basis for symmetry calculations.
Definition: mypaint-symmetry.h:65
MyPaintSymmetryState::center_x
float center_x
The x coordinate of the symmetry center.
Definition: mypaint-symmetry.h:73
MYPAINT_SYMMETRY_TYPE_ROTATIONAL
@ MYPAINT_SYMMETRY_TYPE_ROTATIONAL
rotational symmetry
Definition: mypaint-symmetry.h:43
MyPaintSymmetryType
MyPaintSymmetryType
Enumeration of different kinds of symmetry.
Definition: mypaint-symmetry.h:27
MyPaintSymmetryData::state_pending
MyPaintSymmetryState state_pending
The pending symmetry state.
Definition: mypaint-symmetry.h:110
MyPaintSymmetryData::active
gboolean active
Whether symmetry is used or not.
Definition: mypaint-symmetry.h:120
MyPaintSymmetryState::center_y
float center_y
The y coordinate of the symmetry center.
Definition: mypaint-symmetry.h:77
MyPaintSymmetryState::num_lines
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
mypaint-matrix.h
MYPAINT_SYMMETRY_TYPES_COUNT
@ MYPAINT_SYMMETRY_TYPES_COUNT
number of available symmetry types (only use to enumerate)
Definition: mypaint-symmetry.h:51
MyPaintTransform
3x3 matrix of floats, row-major order.
Definition: mypaint-matrix.h:29