1 /* LIBGIMP - The GIMP Library 2 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball 3 * 4 * gimpmatrix.h 5 * Copyright (C) 1998 Jay Cox <jaycox@gimp.org> 6 * 7 * This library is free software: you can redistribute it and/or 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 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 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 #if !defined (__GIMP_MATH_H_INSIDE__) && !defined (GIMP_MATH_COMPILATION) 23 #error "Only <libgimpmath/gimpmath.h> can be included directly." 24 #endif 25 26 #ifndef __GIMP_MATRIX_H__ 27 #define __GIMP_MATRIX_H__ 28 29 G_BEGIN_DECLS 30 31 /* For information look into the C source or the html documentation */ 32 33 34 /*****************/ 35 /* GimpMatrix2 */ 36 /*****************/ 37 38 #define GIMP_TYPE_MATRIX2 (gimp_matrix2_get_type ()) 39 #define GIMP_VALUE_HOLDS_MATRIX2(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX2)) 40 41 GType gimp_matrix2_get_type (void) G_GNUC_CONST; 42 43 44 #define GIMP_TYPE_PARAM_MATRIX2 (gimp_param_matrix2_get_type ()) 45 #define GIMP_IS_PARAM_SPEC_MATRIX2(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX2)) 46 47 GType gimp_param_matrix2_get_type (void) G_GNUC_CONST; 48 49 GParamSpec * gimp_param_spec_matrix2 (const gchar *name, 50 const gchar *nick, 51 const gchar *blurb, 52 const GimpMatrix2 *default_value, 53 GParamFlags flags); 54 55 56 void gimp_matrix2_identity (GimpMatrix2 *matrix); 57 void gimp_matrix2_mult (const GimpMatrix2 *matrix1, 58 GimpMatrix2 *matrix2); 59 60 gdouble gimp_matrix2_determinant (const GimpMatrix2 *matrix); 61 void gimp_matrix2_invert (GimpMatrix2 *matrix); 62 63 void gimp_matrix2_transform_point (const GimpMatrix2 *matrix, 64 gdouble x, 65 gdouble y, 66 gdouble *newx, 67 gdouble *newy); 68 69 70 /*****************/ 71 /* GimpMatrix3 */ 72 /*****************/ 73 74 #define GIMP_TYPE_MATRIX3 (gimp_matrix3_get_type ()) 75 #define GIMP_VALUE_HOLDS_MATRIX3(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX3)) 76 77 GType gimp_matrix3_get_type (void) G_GNUC_CONST; 78 79 80 #define GIMP_TYPE_PARAM_MATRIX3 (gimp_param_matrix3_get_type ()) 81 #define GIMP_IS_PARAM_SPEC_MATRIX3(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX3)) 82 83 GType gimp_param_matrix3_get_type (void) G_GNUC_CONST; 84 85 GParamSpec * gimp_param_spec_matrix3 (const gchar *name, 86 const gchar *nick, 87 const gchar *blurb, 88 const GimpMatrix3 *default_value, 89 GParamFlags flags); 90 91 92 void gimp_matrix3_identity (GimpMatrix3 *matrix); 93 void gimp_matrix3_mult (const GimpMatrix3 *matrix1, 94 GimpMatrix3 *matrix2); 95 void gimp_matrix3_translate (GimpMatrix3 *matrix, 96 gdouble x, 97 gdouble y); 98 void gimp_matrix3_scale (GimpMatrix3 *matrix, 99 gdouble x, 100 gdouble y); 101 void gimp_matrix3_rotate (GimpMatrix3 *matrix, 102 gdouble theta); 103 void gimp_matrix3_xshear (GimpMatrix3 *matrix, 104 gdouble amount); 105 void gimp_matrix3_yshear (GimpMatrix3 *matrix, 106 gdouble amount); 107 void gimp_matrix3_affine (GimpMatrix3 *matrix, 108 gdouble a, 109 gdouble b, 110 gdouble c, 111 gdouble d, 112 gdouble e, 113 gdouble f); 114 115 gdouble gimp_matrix3_determinant (const GimpMatrix3 *matrix); 116 void gimp_matrix3_invert (GimpMatrix3 *matrix); 117 118 gboolean gimp_matrix3_is_identity (const GimpMatrix3 *matrix); 119 gboolean gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix); 120 gboolean gimp_matrix3_is_affine (const GimpMatrix3 *matrix); 121 gboolean gimp_matrix3_is_simple (const GimpMatrix3 *matrix); 122 123 gboolean gimp_matrix3_equal (const GimpMatrix3 *matrix1, 124 const GimpMatrix3 *matrix2); 125 126 void gimp_matrix3_transform_point (const GimpMatrix3 *matrix, 127 gdouble x, 128 gdouble y, 129 gdouble *newx, 130 gdouble *newy); 131 132 133 /*****************/ 134 /* GimpMatrix4 */ 135 /*****************/ 136 137 void gimp_matrix4_identity (GimpMatrix4 *matrix); 138 void gimp_matrix4_mult (const GimpMatrix4 *matrix1, 139 GimpMatrix4 *matrix2); 140 141 void gimp_matrix4_to_deg (const GimpMatrix4 *matrix, 142 gdouble *a, 143 gdouble *b, 144 gdouble *c); 145 146 gdouble gimp_matrix4_transform_point (const GimpMatrix4 *matrix, 147 gdouble x, 148 gdouble y, 149 gdouble z, 150 gdouble *newx, 151 gdouble *newy, 152 gdouble *newz); 153 154 155 G_END_DECLS 156 157 #endif /* __GIMP_MATRIX_H__ */ 158