MyGUI 3.5.3
MyGUI_CoordConverter.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_COORD_CONVERTER_H_
8#define MYGUI_COORD_CONVERTER_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Types.h"
12#include <tuple>
13
14namespace MyGUI
15{
16
17 class MYGUI_EXPORT CoordConverter
18 {
19 public:
21 static FloatRect convertTextureCoord(const IntCoord& _coord, const IntSize& _textureSize);
22
23 /* Convert from relative to pixel coordinates.
24 @param _coord relative coordinates.
25 */
26 static IntCoord convertFromRelative(const FloatCoord& _coord, const IntSize& _view);
27
28 /* Convert from relative to pixel coordinates.
29 @param _coord relative coordinates.
30 */
31 static IntSize convertFromRelative(const FloatSize& _size, const IntSize& _view);
32
33 /* Convert from relative to pixel coordinates.
34 @param _coord relative coordinates.
35 */
36 static IntPoint convertFromRelative(const FloatPoint& _point, const IntSize& _view);
37
38 /* Convert from pixel to relative coordinates.
39 @param _coord pixel coordinates.
40 */
41 static FloatCoord convertToRelative(const IntCoord& _coord, const IntSize& _view);
42
43 static FloatSize convertToRelative(const IntSize& _size, const IntSize& _view);
44
45 static FloatPoint convertToRelative(const IntPoint& _point, const IntSize& _view);
46
47 static IntCoord convertFromRelative(const DoubleCoord& _coord, const IntSize& _view);
48
49 static DoubleCoord convertToRelativeD(const IntCoord& _coord, const IntSize& _view);
50
51 static std::tuple<IntCoord, bool, bool> applyAlign(
52 Align _align,
53 const IntCoord& _coord,
54 const IntSize& _parentSize,
55 const IntSize& _oldsize);
56 };
57
58} // namespace MyGUI
59
60#endif // MYGUI_COORD_CONVERTER_H_
#define MYGUI_EXPORT
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:26
types::TCoord< float > FloatCoord
Definition MyGUI_Types.h:36
types::TRect< float > FloatRect
Definition MyGUI_Types.h:33
types::TCoord< double > DoubleCoord
Definition MyGUI_Types.h:37
types::TPoint< float > FloatPoint
Definition MyGUI_Types.h:27
types::TSize< float > FloatSize
Definition MyGUI_Types.h:30
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:35
types::TSize< int > IntSize
Definition MyGUI_Types.h:29