libmypaint  1.6.0
mypaint-matrix.h
Go to the documentation of this file.
1 #ifndef MYPAINTMATRIX_H
2 #define MYPAINTMATRIX_H
3 
4 /* libmypaint - The MyPaint Brush Library
5  * Copyright (C) 2019 The MyPaint Team
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
29 typedef struct {
30  float rows[3][3];
32 
45 
55 MyPaintTransform mypaint_transform_rotate_cw(const MyPaintTransform transform, const float angle_radians);
56 
66 MyPaintTransform mypaint_transform_rotate_ccw(const MyPaintTransform transform, const float angle_radians);
67 
77 MyPaintTransform mypaint_transform_reflect(const MyPaintTransform transform, const float angle_radians);
78 
88 MyPaintTransform mypaint_transform_translate(const MyPaintTransform transform, const float x, const float y);
89 
101 void mypaint_transform_point(const MyPaintTransform* const transform, float x, float y, float* x_out, float* y_out);
102 
103 #endif
3x3 matrix of floats, row-major order.
Definition: mypaint-matrix.h:29
MyPaintTransform mypaint_transform_rotate_ccw(const MyPaintTransform transform, const float angle_radians)
Create a new transform by rotating the input transform counterclockwise.
MyPaintTransform mypaint_transform_translate(const MyPaintTransform transform, const float x, const float y)
Create a new transform by reflecting the input transform across a line crossing 0,...
MyPaintTransform mypaint_transform_unit()
3x3 unit matrix
MyPaintTransform mypaint_transform_reflect(const MyPaintTransform transform, const float angle_radians)
Create a new transform by reflecting the input transform across a line crossing 0,...
MyPaintTransform mypaint_transform_rotate_cw(const MyPaintTransform transform, const float angle_radians)
Create a new transform by rotating the input transform clockwise.
void mypaint_transform_point(const MyPaintTransform *const transform, float x, float y, float *x_out, float *y_out)
Apply transformation to a (x, y) point, writing the resulting coordinates to out parameters.