2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 FApp_AppResourceBitmapUtil.h
20 * @brief This is the header file of the _AppResourceBitmapUtil.
23 #ifndef _FAPP_INTERNAL_APP_RESOURCE_BITMAP_UTIL_H_
24 #define _FAPP_INTERNAL_APP_RESOURCE_BITMAP_UTIL_H_
26 #include <FBaseString.h>
28 #include <FGrpBitmap.h>
29 #include <FGrp_BitmapImpl.h>
30 #include <FGrp_CoordinateSystem.h>
32 namespace Tizen { namespace Graphics
38 namespace Tizen { namespace Media
43 namespace Tizen { namespace App
45 class _AppResourceBitmapUtil
46 : public Tizen::Base::Object
64 APP_RESOURCE_BY_APP_ID,
65 APP_RESOURCE_BY_LIBRARY_NAME,
69 // This is the default constructor for this class.
70 _AppResourceBitmapUtil(void);
72 // This is the destructor for this class.
73 virtual ~_AppResourceBitmapUtil(void);
75 //Get device's DPI, application's logical resolution and set fall back system
76 result Construct(const Tizen::Base::String& resourceFolder);
78 // Generates the directory path from the specified resolution.
79 bool GetDirectoryPath(const Tizen::Base::String& homePath, _Density resourceDirectory, Tizen::Base::String& dirPath) const;
81 // Generates the real path using a pseudo-path and the specified resolution.
82 bool GetFilePath(const Tizen::Base::String& directoryPath, const Tizen::Base::String& fileName, Tizen::Base::String& filePath) const;
84 // The normalized path starts with and is divided by '/'.
85 // ex. L"/Dir1/Dir2/Dir3/File"
86 Tizen::Base::String NormalizePath(const Tizen::Base::String& path) const;
88 // Generates the real path and examine whether the size of the resource is logical or physical by processing the input path.
89 result GetResourcePath(const Tizen::Base::String& fileName, Tizen::Base::String& resourcePath, _Density& resourceDensity, bool& imageScaling) const;
91 // Create Bitmap from real image path
92 Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& resourcePath, _Density resourceDensity,
93 Tizen::Graphics::BitmapPixelFormat pixelFormat, bool imageScaling, const Tizen::Graphics::Color* pChromaKeyColor = null) const;
95 static _AppResourceBitmapUtil* GetInstanceN(int type = APP_RESOURCE_DEFAULT, const Tizen::Base::String& value = L"");
97 Tizen::App::_AppResourceBitmapUtil::AppResourceBy GetAppResourceType(void);
100 // This is the copy constructor for this class.
101 _AppResourceBitmapUtil(const _AppResourceBitmapUtil& rhs);
103 // This is the assignment operator for this class.
104 _AppResourceBitmapUtil& operator =(const _AppResourceBitmapUtil& rhs);
107 static const int DPI_FOR_XHIGH = 290;
108 static const int DPI_FOR_HIGH = 200;
109 static const int DPI_FOR_MIDDLE = 150;
110 static const int DPI_FOR_LOW = 0;
112 Tizen::Graphics::Dimension __physicalResolutionDim;
113 Tizen::Graphics::_BaseScreenSize __physicalBaseScreenSize;
115 // resource directory path for only device's resolution.
116 Tizen::Base::String __resolutionDirectories;
119 * Index information of __sortedDensity & __sortedDensityDirectories.
120 * '0' is for screen density matched device's DPI.
121 * '1', '2', '3' is for screen density with fall back system.
123 _Density __sortedDensity[DENSITY_MAX];
124 Tizen::Base::String __sortedDensityDirectories[DENSITY_MAX];
126 Tizen::App::_AppResourceBitmapUtil::AppResourceBy __resourceType;
128 }; // _AppResourceBitmapUtil
132 #endif // _FAPP_INTERNAL_APP_RESOURCE_BITMAP_UTIL_H_