2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FGrp_CoordinateSystem.h
20 * @brief This is the header file for _CoordinateSystem class.
24 #ifndef _FGRP_INTERNAL_COORDINATE_SYSTEM_H_
25 #define _FGRP_INTERNAL_COORDINATE_SYSTEM_H_
28 #include <FGrpPoint.h>
29 #include <FGrpDimension.h>
30 #include <FGrpRectangle.h>
33 namespace Tizen { namespace Graphics
36 enum _LogicalResolution
38 RESOLUTION_LOGICAL_NONE,
39 RESOLUTION_LOGICAL_DEFAULT,
41 RESOLUTION_LOGICAL_240,
42 RESOLUTION_LOGICAL_320,
43 RESOLUTION_LOGICAL_360,
44 RESOLUTION_LOGICAL_480,
45 RESOLUTION_LOGICAL_720,
46 RESOLUTION_LOGICAL_800,
47 RESOLUTION_LOGICAL_960,
48 RESOLUTION_LOGICAL_1080,
49 RESOLUTION_LOGICAL_1440,
50 RESOLUTION_LOGICAL_1600
53 enum _PhysicalResolution
55 RESOLUTION_PHYSICAL_NONE,
56 RESOLUTION_PHYSICAL_DEFAULT,
58 RESOLUTION_PHYSICAL_WVGA,
59 RESOLUTION_PHYSICAL_WQVGA,
60 RESOLUTION_PHYSICAL_HVGA,
61 //RESOLUTION_PHYSICAL_QHD,
62 RESOLUTION_PHYSICAL_HD,
63 RESOLUTION_PHYSICAL_WXGA,
64 RESOLUTION_PHYSICAL_HD1080,
65 RESOLUTION_PHYSICAL_WQXGA
70 BASE_SCREEN_SIZE_NONE,
71 BASE_SCREEN_SIZE_DEFAULT,
73 BASE_SCREEN_SIZE_NORMAL,
74 BASE_SCREEN_SIZE_LARGE
77 class _OSP_EXPORT_ _ICoordinateSystemTransformer
80 virtual ~_ICoordinateSystemTransformer(void) {}
82 virtual Rectangle Transform(const Rectangle& rect) const = 0;
83 virtual Dimension Transform(const Dimension& dim) const = 0;
84 virtual Point Transform(const Point& point) const = 0;
86 virtual int Transform(int scalar) const = 0;
87 virtual int TransformHorizontal(int scalar) const = 0;
88 virtual int TransformVertical(int scalar) const = 0;
90 virtual float Transform(float scalar) const = 0;
91 virtual float TransformHorizontal(float scalar) const = 0;
92 virtual float TransformVertical(float scalar) const = 0;
94 virtual float GetHorizontalScaleFactor(void) const = 0;
95 virtual float GetVerticalScaleFactor(void) const = 0;
97 }; // _ICoordinateSystemTransformer
99 class _OSP_EXPORT_ _NullCoordinateSystemTransformer
100 : public _ICoordinateSystemTransformer
104 _NullCoordinateSystemTransformer(void)
108 virtual Rectangle Transform(const Rectangle& rect) const
113 virtual Dimension Transform(const Dimension& dim) const
118 virtual Point Transform(const Point& point) const
123 virtual int Transform(int scalar) const
128 virtual int TransformHorizontal(int scalar) const
133 virtual int TransformVertical(int scalar) const
138 virtual float Transform(float scalar) const
143 virtual float TransformHorizontal(float scalar) const
148 virtual float TransformVertical(float scalar) const
153 virtual int TransformFloatToInt(float scalar) const
155 return static_cast<int>(scalar);
158 virtual int TransformHorizontalFloatToInt(float scalar) const
160 return static_cast<int>(scalar);
163 virtual int TransformVerticalFloatToInt(float scalar) const
165 return static_cast<int>(scalar);
168 virtual float GetHorizontalScaleFactor(void) const
173 virtual float GetVerticalScaleFactor(void) const
177 }; // _NullCoordinateSystemTransformer
179 class _OSP_EXPORT_ _CoordinateSystem
182 static _CoordinateSystem* GetInstance(void);
184 _LogicalResolution GetNativeLogicalResolution(void) const;
185 _BaseScreenSize GetNativeLogicalBaseScreenSize(void) const;
187 _LogicalResolution GetLogicalResolution(void) const;
188 int GetLogicalResolutionInt(void) const;
190 _PhysicalResolution GetPhysicalResolution(void) const;
191 Dimension GetPhysicalResolutionDim(void) const;
193 _BaseScreenSize GetLogicalBaseScreenSize(void) const;
194 _BaseScreenSize GetPhysicalBaseScreenSize(void) const;
196 static result Initialize(_LogicalResolution logicalResolution, _BaseScreenSize logicalBaseScreenSize);
197 static result Initialize(int srcRes, _BaseScreenSize srcBaseScreenSize, Dimension destRes, _BaseScreenSize destBaseScreenSize);
198 result Reset(_LogicalResolution logicalResolution, _BaseScreenSize logicalBaseScreenSize);
199 result Reset(int srcRes, _BaseScreenSize srcBaseScreenSize, Dimension destRes, _BaseScreenSize destBaseScreenSize);
201 _ICoordinateSystemTransformer* GetTransformer(void);
202 _ICoordinateSystemTransformer* GetInverseTransformer(void);
204 static _ICoordinateSystemTransformer* GetTransformerN(const Dimension& srcDim, const Dimension& trgDim);
205 static _ICoordinateSystemTransformer* GetTransformerN(_LogicalResolution logicalResolution, _PhysicalResolution physicalResolution);
206 static _ICoordinateSystemTransformer* GetTransformerN(_LogicalResolution sourceLogicalResolution, _LogicalResolution destLogicalResolution);
207 static _ICoordinateSystemTransformer* GetTransformerN(_LogicalResolution logicalResolution, _BaseScreenSize logicalBaseScreenSize, _PhysicalResolution physicalResolution, _BaseScreenSize physicalBaseScreenSize);
208 static _ICoordinateSystemTransformer* GetTransformerN(int srcResolution, _BaseScreenSize srcBaseScreenSize, Dimension destResolution, _BaseScreenSize destBaseScreenSize);
210 void SetTransformEnabled(bool enabled);
211 bool IsTransformEnabled(void) const;
214 _CoordinateSystem(void);
215 ~_CoordinateSystem(void);
217 _CoordinateSystem(const _CoordinateSystem&);
218 _CoordinateSystem& operator =(const _CoordinateSystem&);
220 result __Initialize(_LogicalResolution logicalResolution, _BaseScreenSize logicalBaseScreenSize);
221 result __Initialize(int srcResolution, _BaseScreenSize srcBaseScreenSize, Dimension destResolution, _BaseScreenSize destBaseScreenSize);
223 static void __InitCoordinateSystem(void);
226 static _CoordinateSystem __instance;
227 static _CoordinateSystem* __pTheInstance;
229 class _CoordinateSystemImpl;
230 _CoordinateSystemImpl* __pImpl;
232 }; // _CoordinateSystem
234 }} // Tizen::Graphics
236 #endif // _FGRP_INTERNAL_COORDINATE_SYSTEM_H_