gimpmatrix.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 2 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, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef __GIMP_MATRIX_H__
  23. #define __GIMP_MATRIX_H__
  24. G_BEGIN_DECLS
  25. /* For information look into the C source or the html documentation */
  26. struct _GimpMatrix2
  27. {
  28. gdouble coeff[2][2];
  29. };
  30. struct _GimpMatrix3
  31. {
  32. gdouble coeff[3][3];
  33. };
  34. struct _GimpMatrix4
  35. {
  36. gdouble coeff[4][4];
  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. GType gimp_matrix2_get_type (void) G_GNUC_CONST;
  41. #define GIMP_TYPE_PARAM_MATRIX2 (gimp_param_matrix2_get_type ())
  42. #define GIMP_IS_PARAM_SPEC_MATRIX2(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX2))
  43. GType gimp_param_matrix2_get_type (void) G_GNUC_CONST;
  44. GParamSpec * gimp_param_spec_matrix2 (const gchar *name,
  45. const gchar *nick,
  46. const gchar *blurb,
  47. const GimpMatrix2 *default_value,
  48. GParamFlags flags);
  49. void gimp_matrix2_identity (GimpMatrix2 *matrix);
  50. void gimp_matrix2_mult (const GimpMatrix2 *matrix1,
  51. GimpMatrix2 *matrix2);
  52. void gimp_matrix3_identity (GimpMatrix3 *matrix);
  53. void gimp_matrix3_mult (const GimpMatrix3 *matrix1,
  54. GimpMatrix3 *matrix2);
  55. void gimp_matrix3_translate (GimpMatrix3 *matrix,
  56. gdouble x,
  57. gdouble y);
  58. void gimp_matrix3_scale (GimpMatrix3 *matrix,
  59. gdouble x,
  60. gdouble y);
  61. void gimp_matrix3_rotate (GimpMatrix3 *matrix,
  62. gdouble theta);
  63. void gimp_matrix3_xshear (GimpMatrix3 *matrix,
  64. gdouble amount);
  65. void gimp_matrix3_yshear (GimpMatrix3 *matrix,
  66. gdouble amount);
  67. void gimp_matrix3_affine (GimpMatrix3 *matrix,
  68. gdouble a,
  69. gdouble b,
  70. gdouble c,
  71. gdouble d,
  72. gdouble e,
  73. gdouble f);
  74. gdouble gimp_matrix3_determinant (const GimpMatrix3 *matrix);
  75. void gimp_matrix3_invert (GimpMatrix3 *matrix);
  76. gboolean gimp_matrix3_is_identity (const GimpMatrix3 *matrix);
  77. gboolean gimp_matrix3_is_diagonal (const GimpMatrix3 *matrix);
  78. gboolean gimp_matrix3_is_affine (const GimpMatrix3 *matrix);
  79. gboolean gimp_matrix3_is_simple (const GimpMatrix3 *matrix);
  80. void gimp_matrix3_transform_point (const GimpMatrix3 *matrix,
  81. gdouble x,
  82. gdouble y,
  83. gdouble *newx,
  84. gdouble *newy);
  85. void gimp_matrix4_to_deg (const GimpMatrix4 *matrix,
  86. gdouble *a,
  87. gdouble *b,
  88. gdouble *c);
  89. G_END_DECLS
  90. #endif /* __GIMP_MATRIX_H__ */