PageRenderTime 27ms CodeModel.GetById 22ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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