gimpmatrix.h 5.69 KB
Newer Older
1
/* LIBGIMP - The GIMP Library
2 3 4
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
 *
 * gimpmatrix.h
5
 * Copyright (C) 1998 Jay Cox <jaycox@gimp.org>
6
 *
7
 * This library is free software: you can redistribute it and/or
Marc Lehmann's avatar
Marc Lehmann committed
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 3 of the License, or (at your option) any later version.
11 12 13 14
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
Marc Lehmann's avatar
Marc Lehmann committed
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library.  If not, see
19
 * <https://www.gnu.org/licenses/>.
20 21
 */

22 23 24 25
#if !defined (__GIMP_MATH_H_INSIDE__) && !defined (GIMP_MATH_COMPILATION)
#error "Only <libgimpmath/gimpmath.h> can be included directly."
#endif

26 27 28
#ifndef __GIMP_MATRIX_H__
#define __GIMP_MATRIX_H__

29
G_BEGIN_DECLS
30

31
/* For information look into the C source or the html documentation */
32

33 34 35 36 37

/*****************/
/*  GimpMatrix2  */
/*****************/

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#define GIMP_TYPE_MATRIX2               (gimp_matrix2_get_type ())
#define GIMP_VALUE_HOLDS_MATRIX2(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX2))

GType         gimp_matrix2_get_type        (void) G_GNUC_CONST;


#define GIMP_TYPE_PARAM_MATRIX2            (gimp_param_matrix2_get_type ())
#define GIMP_IS_PARAM_SPEC_MATRIX2(pspec)  (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX2))

GType         gimp_param_matrix2_get_type  (void) G_GNUC_CONST;

GParamSpec *  gimp_param_spec_matrix2      (const gchar        *name,
                                            const gchar        *nick,
                                            const gchar        *blurb,
                                            const GimpMatrix2  *default_value,
                                            GParamFlags         flags);

55

56
void          gimp_matrix2_identity        (GimpMatrix2       *matrix);
57
void          gimp_matrix2_mult            (const GimpMatrix2 *matrix1,
58
                                            GimpMatrix2       *matrix2);
59

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82

/*****************/
/*  GimpMatrix3  */
/*****************/

#define GIMP_TYPE_MATRIX3               (gimp_matrix3_get_type ())
#define GIMP_VALUE_HOLDS_MATRIX3(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX3))

GType         gimp_matrix3_get_type        (void) G_GNUC_CONST;


#define GIMP_TYPE_PARAM_MATRIX3            (gimp_param_matrix3_get_type ())
#define GIMP_IS_PARAM_SPEC_MATRIX3(pspec)  (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX3))

GType         gimp_param_matrix3_get_type  (void) G_GNUC_CONST;

GParamSpec *  gimp_param_spec_matrix3      (const gchar        *name,
                                            const gchar        *nick,
                                            const gchar        *blurb,
                                            const GimpMatrix3  *default_value,
                                            GParamFlags         flags);


83
void          gimp_matrix3_identity        (GimpMatrix3       *matrix);
84
void          gimp_matrix3_mult            (const GimpMatrix3 *matrix1,
85
                                            GimpMatrix3       *matrix2);
86
void          gimp_matrix3_translate       (GimpMatrix3       *matrix,
87 88
                                            gdouble            x,
                                            gdouble            y);
89
void          gimp_matrix3_scale           (GimpMatrix3       *matrix,
90 91
                                            gdouble            x,
                                            gdouble            y);
92
void          gimp_matrix3_rotate          (GimpMatrix3       *matrix,
93
                                            gdouble            theta);
94
void          gimp_matrix3_xshear          (GimpMatrix3       *matrix,
95
                                            gdouble            amount);
96
void          gimp_matrix3_yshear          (GimpMatrix3       *matrix,
97
                                            gdouble            amount);
98 99 100 101 102 103 104 105
void          gimp_matrix3_affine          (GimpMatrix3       *matrix,
                                            gdouble            a,
                                            gdouble            b,
                                            gdouble            c,
                                            gdouble            d,
                                            gdouble            e,
                                            gdouble            f);

106 107
gdouble       gimp_matrix3_determinant     (const GimpMatrix3 *matrix);
void          gimp_matrix3_invert          (GimpMatrix3       *matrix);
108

109
gboolean      gimp_matrix3_is_identity     (const GimpMatrix3 *matrix);
Sven Neumann's avatar
Sven Neumann committed
110 111
gboolean      gimp_matrix3_is_diagonal     (const GimpMatrix3 *matrix);
gboolean      gimp_matrix3_is_affine       (const GimpMatrix3 *matrix);
112 113
gboolean      gimp_matrix3_is_simple       (const GimpMatrix3 *matrix);

114
void          gimp_matrix3_transform_point (const GimpMatrix3 *matrix,
115 116 117 118
                                            gdouble            x,
                                            gdouble            y,
                                            gdouble           *newx,
                                            gdouble           *newy);
119

120 121 122 123

/*****************/
/*  GimpMatrix4  */
/*****************/
124

125
void          gimp_matrix4_to_deg          (const GimpMatrix4 *matrix,
126 127 128
                                            gdouble           *a,
                                            gdouble           *b,
                                            gdouble           *c);
129

130

131
G_END_DECLS
132

133
#endif /* __GIMP_MATRIX_H__ */