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 FGrpCoordinateSystem.cpp
20 * @brief This is the cpp file for CoordinateSystem class.
24 #include <FGrpCoordinateSystem.h>
26 #include <FBaseSysLog.h>
28 #include "FGrp_CoordinateSystem.h"
29 #include "FGrp_Screen.h"
35 Tizen::Graphics::Dimension
36 ConvertToDimension(Tizen::Graphics::_LogicalResolution logicalResolution)
41 switch (logicalResolution)
43 case Tizen::Graphics::RESOLUTION_LOGICAL_240:
47 case Tizen::Graphics::RESOLUTION_LOGICAL_320:
51 case Tizen::Graphics::RESOLUTION_LOGICAL_480:
55 case Tizen::Graphics::RESOLUTION_LOGICAL_720:
60 width = Tizen::Graphics::_CoordinateSystem::GetInstance()->GetLogicalResolutionInt();
61 height = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(Tizen::Graphics::_Screen::GetHeight());
65 return Tizen::Graphics::Dimension(width,height);
71 namespace Tizen { namespace Graphics
75 CoordinateSystem::GetLogicalResolution(void)
77 _LogicalResolution logicalResolution = Tizen::Graphics::_CoordinateSystem::GetInstance()->GetLogicalResolution();
79 return ConvertToDimension(logicalResolution);
83 CoordinateSystem::GetPhysicalResolution(void)
85 return Dimension(_Screen::GetWidth(), _Screen::GetHeight());
89 CoordinateSystem::ConvertToLogicalX(int physicalX)
91 _ICoordinateSystemTransformer* pTransformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
93 return (pTransformer) ? pTransformer->TransformHorizontal(physicalX) : physicalX;
97 CoordinateSystem::ConvertToLogicalY(int physicalY)
99 _ICoordinateSystemTransformer* pTransformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
101 return (pTransformer) ? pTransformer->TransformVertical(physicalY) : physicalY;
105 CoordinateSystem::ConvertToPhysicalX(int logicalX)
107 _ICoordinateSystemTransformer* pTransformer = _CoordinateSystem::GetInstance()->GetTransformer();
109 return (pTransformer) ? pTransformer->TransformHorizontal(logicalX) : logicalX;
113 CoordinateSystem::ConvertToPhysicalY(int logicalY)
115 _ICoordinateSystemTransformer* pTransformer = _CoordinateSystem::GetInstance()->GetTransformer();
117 return (pTransformer) ? pTransformer->TransformVertical(logicalY) : logicalY;
120 }} // Tizen::Graphics