gimpmatrix.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. #if !defined (__GIMP_MATH_H_INSIDE__) && !defined (GIMP_MATH_COMPILATION)
  22. #error "Only <libgimpmath/gimpmath.h> can be included directly."
  23. #endif
  24. #ifndef __GIMP_MATRIX_H__
  25. #define __GIMP_MATRIX_H__
  26. G_BEGIN_DECLS
  27. /* For information look into the C source or the html documentation */
  28. /*****************/
  29. /* GimpMatrix2 */
  30. /*****************/
  31. #define GIMP_TYPE_MATRIX2 (gimp_matrix2_get_type ())
  32. #define GIMP_VALUE_HOLDS_MATRIX2(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX2))
  33. GType gimp_matrix2_get_type (void) G_GNUC_CONST;
  34. #define GIMP_TYPE_PARAM_MATRIX2 (gimp_param_matrix2_get_type ())
  35. #define GIMP_IS_PARAM_SPEC_MATRIX2(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX2))
  36. GType gimp_param_matrix2_get_type (void) G_GNUC_CONST;
  37. GParamSpec * gimp_param_spec_matrix2 (const gchar *name,
  38. const gchar *nick,
  39. const gchar *blurb,
  40. const GimpMatrix2 *default_value,
  41. GParamFlags flags);
  42. void gimp_matrix2_identity (GimpMatrix2 *matrix);
  43. void gimp_matrix2_mult (const GimpMatrix2 *left,
  44. GimpMatrix2 *right);
  45. gdouble gimp_matrix2_determinant (const GimpMatrix2 *matrix);
  46. void gimp_matrix2_invert (GimpMatrix2 *matrix);
  47. void gimp_matrix2_transform_point (const GimpMatrix2 *matrix,
  48. gdouble x,
  49. gdouble y,
  50. gdouble *newx,
  51. gdouble *newy);
  52. /*****************/
  53. /* GimpMatrix3 */
  54. /*****************/
  55. #define GIMP_TYPE_MATRIX3 (gimp_matrix3_get_type ())
  56. #define GIMP_VALUE_HOLDS_MATRIX3(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX3))
  57. GType gimp_matrix3_get_type (void) G_GNUC_CONST;
  58. #define GIMP_TYPE_PARAM_MATRIX3 (gimp_param_matrix3_get_type ())
  59. #define GIMP_IS_PARAM_SPEC_MATRIX3(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX3))
  60. GType gimp_param_matrix3_get_type (void) G_GNUC_CONST;
  61. GParamSpec * gimp_param_spec_matrix3 (const gchar *name,
  62. const gchar *nick,
  63. const gchar *blurb,
  64. const GimpMatrix3 *default_value,
  65. GParamFlags flags);
  66. void gimp_matrix3_identity (GimpMatrix3 *matrix);
  67. void gimp_matrix3_mult (const GimpMatrix3 *left,
  68. GimpMatrix3 *right);
  69. void gimp_matrix3_translate (GimpMatrix3 *matrix,
  70. gdouble x,
  71. gdouble y);
  72. void gimp_matrix3_scale (GimpMatrix3 *matrix,
  73. gdouble x,
  74. gdouble y);
  75. void gimp_matrix3_rotate (GimpMatrix3 *matrix,
  76. gdouble theta);
  77. void gimp_matrix3_xshear (GimpMatrix3 *matrix,
  78. gdouble amount);
  79. void gimp_matrix3_yshear (GimpMatrix3 *matrix,
  80. gdouble amount);
  81. void gimp_matrix3_affine (GimpMatrix3 *matrix,
  82. gdouble a,
  83. gdouble b,
  84. gdouble c,
  85. gdouble d,
  86. gdouble e,
  87. gdouble f);
  88. gdouble gimp_matrix3_determinant (const GimpMatrix3 *matrix);
  89. void gimp_matrix3_invert (GimpMatrix3 *matrix);
  90. gboolean gimp_matrix3_is_identity (const GimpMatrix3 *matrix);
  91. gboolean gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix);
  92. gboolean gimp_matrix3_is_affine (const GimpMatrix3 *matrix);
  93. gboolean gimp_matrix3_is_simple (const GimpMatrix3 *matrix);
  94. gboolean gimp_matrix3_equal (const GimpMatrix3 *matrix1,
  95. const GimpMatrix3 *matrix2);
  96. void gimp_matrix3_transform_point (const GimpMatrix3 *matrix,
  97. gdouble x,
  98. gdouble y,
  99. gdouble *newx,
  100. gdouble *newy);
  101. /*****************/
  102. /* GimpMatrix4 */
  103. /*****************/
  104. void gimp_matrix4_identity (GimpMatrix4 *matrix);
  105. void gimp_matrix4_mult (const GimpMatrix4 *left,
  106. GimpMatrix4 *right);
  107. void gimp_matrix4_to_deg (const GimpMatrix4 *matrix,
  108. gdouble *a,
  109. gdouble *b,
  110. gdouble *c);
  111. gdouble gimp_matrix4_transform_point (const GimpMatrix4 *matrix,
  112. gdouble x,
  113. gdouble y,
  114. gdouble z,
  115. gdouble *newx,
  116. gdouble *newy,
  117. gdouble *newz);
  118. G_END_DECLS
  119. #endif /* __GIMP_MATRIX_H__ */