An LGPL/GPL-licensed artwork library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

art_affine.h 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* Libart_LGPL - library of basic graphic primitives
  2. * Copyright (C) 1998 Raph Levien
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. #ifndef __ART_AFFINE_H__
  20. #define __ART_AFFINE_H__
  21. #ifdef LIBART_COMPILATION
  22. #include "art_config.h"
  23. #include "art_point.h"
  24. #else
  25. #include <libart_lgpl/art_config.h>
  26. #include <libart_lgpl/art_point.h>
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif /* __cplusplus */
  31. LIBART_EXPORT void
  32. art_affine_point (ArtPoint *dst, const ArtPoint *src,
  33. const double affine[6]);
  34. LIBART_EXPORT void
  35. art_affine_invert (double dst_affine[6], const double src_affine[6]);
  36. /* flip the matrix, FALSE, FALSE is a simple copy operation, and
  37. TRUE, TRUE equals a rotation by 180 degrees */
  38. LIBART_EXPORT void
  39. art_affine_flip (double dst_affine[6], const double src_affine[6],
  40. int horz, int vert);
  41. LIBART_EXPORT void
  42. art_affine_to_string (char str[128], const double src[6]);
  43. LIBART_EXPORT void
  44. art_affine_multiply (double dst[6],
  45. const double src1[6], const double src2[6]);
  46. /* set up the identity matrix */
  47. LIBART_EXPORT void
  48. art_affine_identity (double dst[6]);
  49. /* set up a scaling matrix */
  50. LIBART_EXPORT void
  51. art_affine_scale (double dst[6], double sx, double sy);
  52. /* set up a rotation matrix; theta is given in degrees */
  53. LIBART_EXPORT void
  54. art_affine_rotate (double dst[6], double theta);
  55. /* set up a shearing matrix; theta is given in degrees */
  56. LIBART_EXPORT void
  57. art_affine_shear (double dst[6], double theta);
  58. /* set up a translation matrix */
  59. LIBART_EXPORT void
  60. art_affine_translate (double dst[6], double tx, double ty);
  61. /* find the affine's "expansion factor", i.e. the scale amount */
  62. LIBART_EXPORT double
  63. art_affine_expansion (const double src[6]);
  64. /* Determine whether the affine transformation is rectilinear,
  65. i.e. whether a rectangle aligned to the grid is transformed into
  66. another rectangle aligned to the grid. */
  67. LIBART_EXPORT int
  68. art_affine_rectilinear (const double src[6]);
  69. /* Determine whether two affine transformations are equal within grid allignment */
  70. LIBART_EXPORT int
  71. art_affine_equal (double matrix1[6], double matrix2[6]);
  72. #ifdef __cplusplus
  73. }
  74. #endif /* __cplusplus */
  75. #endif /* __ART_AFFINE_H__ */