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_AppResourceBitmap.h
20 * @brief This is the header file of the _AppResourceBitmap class.
23 #ifndef _FAPP_INTERNAL_APP_RESOURCE_BITMAP_H_
24 #define _FAPP_INTERNAL_APP_RESOURCE_BITMAP_H_
26 #include <unique_ptr.h>
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FOspConfig.h>
31 #include "FApp_IAppResourceBitmap.h"
33 namespace Tizen { namespace App
35 class _AppResourceBitmapUtil;
37 class _AppResourceBitmap
38 : public Tizen::Base::Object
39 , public _IAppResourceBitmap
43 * Gets the bitmap at the specified path. @n
44 * The %GetBitmapN() method interprets the given resource path and reads the best matching image file for the current device resolution. @n
45 * To load the bitmap image from a file, give the name of the file as the input parameter and not the file path (For example: "img.png").
46 * Then, the system will first look for the image file in the folder specific to the current device resolution, such as
47 * '720x1280' and if the file does not exist, it will then search the folder that corresponds to the current screen density,
48 * such as 'screen-density-xhigh'. After searching the density folder, all the other density folders are searched in the order high to low.
49 * Currently supported image formats are: JPEG, GIF, PNG, BMP, TIFF, and WBMP.
51 * In this method, the system decides the proper pixel format.
52 * Currently supported image formats are: JPEG, GIF, PNG, BMP, TIFF, and WBMP.
56 * @return A pointer to the Tizen::Graphics::Bitmap instance generated from the specified file
57 * @param[in] imagePath The relative path starting from the density directory @b "res/screen-density-XXX/" or @b "res/AxB", @n
58 * where A and B represent the width and height of the screen of the supported device models, respectively
59 * @exception E_SUCCESS The method is successful.
60 * @exception E_INVALID_ARG The specified input parameter is invalid.
61 * @exception E_UNSUPPORTED_FORMAT The image file format is not supported.
62 * @exception E_FILE_NOT_FOUND The specified file cannot be found.
63 * @exception E_SYSTEM A system error has occurred.
64 * @remarks The specific error code can be accessed using the GetLastResult() method.
65 * @remarks There is a high probability for an occurrence of an out-of-memory exception. If possible, check whether the exception is E_OUT_OF_MEMORY or not. For more information on how to handle the out-of-memory exception, refer <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/exception_check.htm">here</a>.
67 virtual Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& imagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat) const;
69 static _AppResourceBitmap* GetInstance(void);
71 static _AppResourceBitmap* GetInstanceByAppId(const Tizen::Base::String& appId);
75 * This is the default constructor for this class.
77 _AppResourceBitmap(void);
80 * This is the copy constructor for this class.
82 _AppResourceBitmap(const _AppResourceBitmap& rhs);
85 * This is the destructor for this class.
87 virtual ~_AppResourceBitmap(void);
90 * Initializes this instance of _AppResourceBitmap.
92 result Construct(void);
94 result Construct(const Tizen::Base::String& appId);
97 * This is the assignment operator for this class.
99 _AppResourceBitmap& operator =(const _AppResourceBitmap& rhs);
101 static void InitAppResourceBitmap(void);
104 std::unique_ptr<_AppResourceBitmapUtil> __pAppResourceBitmapUtil;
106 static _AppResourceBitmap* __pTheInstance;
108 }; // _AppResourceBitmap
112 #endif // _FAPP_INTERNAL_APP_RESOURCE_BITMAP_H_