/src/wrappers/cairo/library/cairo_point.e

http://github.com/tybor/Liberty · Specman e · 119 lines · 74 code · 19 blank · 26 comment · 2 complexity · 669875a83dc0bd7cc5340dc86551fe42 MD5 · raw file

  1. note
  2. description: "A point in bidimentional space (for Cairo)."
  3. copyright: "[
  4. Copyright (C) 2007-2017: Paolo Redaelli,
  5. Soluciones Informaticas Libres S.A. (Except),
  6. Cairo team
  7. This library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public License
  9. as published by the Free Software Foundation; either version 2.1 of
  10. the License, or (at your option) any later version.
  11. This library is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. 02110-1301 USA
  19. ]"
  20. date: "$Date:$"
  21. revision: "$Revision:$"
  22. wrapped_version: "1.2.4"
  23. class CAIRO_POINT
  24. inherit
  25. ANY
  26. WRAPPER_HANDLER
  27. insert
  28. CAIRO_MATRIX_EXTERNALS
  29. CAIRO_TRANSFORMATIONS_EXTERNALS
  30. create {ANY} make
  31. feature {} -- Creation
  32. make (an_x, an_y: REAL)
  33. do
  34. x := an_x
  35. y := an_y
  36. end
  37. feature {ANY}
  38. x, y: REAL
  39. transform_distance (a_matrix: CAIRO_MATRIX)
  40. -- Transforms Current point handled as a distance vector
  41. -- (dx,dy) by `a_matrix'. This is similar to
  42. -- `transform_point' except that the translation components
  43. -- of the transformation are ignored. The calculation of the
  44. -- returned vector is as follows:
  45. -- dx2 = dx1 * a + dy1 * c;
  46. -- dy2 = dx1 * b + dy1 * d;
  47. -- Affine transformations are position invariant, so the same
  48. -- vector always transforms to the same vector. If (x1,y1)
  49. -- transforms to (x2,y2) then (x1+dx1,y1+dy1) will transform
  50. -- to (x1+dx2,y1+dy2) for all values of x1 and x2.
  51. require matrix_not_void: a_matrix /= Void
  52. do
  53. cairo_matrix_transform_distance (a_matrix.handle, $x, $y)
  54. end
  55. transform_point (a_matrix: CAIRO_MATRIX)
  56. -- Transforms Current point (x, y) by matrix.
  57. require matrix_not_void: a_matrix /= Void
  58. do
  59. cairo_matrix_transform_point (a_matrix.handle, $x, $y)
  60. end
  61. feature {ANY} -- Trasformations between user-space and device space
  62. from_user_to_device (a_context: CAIRO_CONTEXT)
  63. -- Transform the point from user space to device space by
  64. -- multiplying the given point by the current transformation
  65. -- matrix (CTM).
  66. require
  67. context_not_void: a_context /= Void
  68. do
  69. cairo_user_to_device (a_context.handle, $x, $y)
  70. end
  71. from_user_to_device_distance (a_context: CAIRO_CONTEXT)
  72. -- Transform the point handled as a distance vector from user
  73. -- space to device space. This feature is similar to
  74. -- `from_user_to_device' except that the translation
  75. -- components of the CTM will be ignored when transforming.
  76. require
  77. context_not_void: a_context /= Void
  78. do
  79. cairo_user_to_device_distance (a_context.handle, $x, $y)
  80. end
  81. from_device_to_user (a_context: CAIRO_CONTEXT)
  82. -- Transform a coordinate from device space to user space by
  83. -- multiplying the given point by the inverse of the current
  84. -- transformation matrix (CTM).
  85. require
  86. context_not_void: a_context /= Void
  87. do
  88. cairo_device_to_user (a_context.handle, $x, $y)
  89. end
  90. from_device_to_user_distance (a_context: CAIRO_CONTEXT)
  91. -- Transform point handled as a distance vector from device
  92. -- space to user space. This function is similar to
  93. -- `device_to_user' except that the translation components of
  94. -- the inverse CTM will be ignored when transforming.
  95. require
  96. context_not_void: a_context /= Void
  97. do
  98. cairo_device_to_user_distance (a_context.handle, $x, $y)
  99. end
  100. end -- class CAIRO_POINT