merge with master
[platform/framework/native/uifw.git] / src / app / FApp_AppResourceBitmap.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        FApp_AppResourceBitmap.h
20  * @brief       This is the header file of the _AppResourceBitmap class.
21  */
22
23 #ifndef _FAPP_INTERNAL_APP_RESOURCE_BITMAP_H_
24 #define _FAPP_INTERNAL_APP_RESOURCE_BITMAP_H_
25
26 #include <unique_ptr.h>
27
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FOspConfig.h>
31 #include "FApp_IAppResourceBitmap.h"
32
33 namespace Tizen { namespace App
34 {
35
36 class _AppResourceBitmapUtil;
37
38 class _AppResourceBitmap
39         : public Tizen::Base::Object
40         , public _IAppResourceBitmap
41 {
42 public:
43         /**
44         * Gets the bitmap at the specified path. @n
45         * The %GetBitmapN() method interprets the given resource path and reads the best matching image file for the current device resolution. @n
46         * 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").
47         * Then, the system will first look for the image file in the folder specific to the current device resolution, such as
48         * '720x1280' and if the file does not exist, it will then search the folder that corresponds to the current screen density,
49         * such as 'screen-density-xhigh'. After searching the density folder, all the other density folders are searched in the order high to low.
50         * Currently supported image formats are: JPEG, GIF, PNG, BMP, TIFF, and WBMP.
51         *
52         * In this method, the system decides the proper pixel format.
53         * Currently supported image formats are: JPEG, GIF, PNG, BMP, TIFF, and WBMP.
54         *
55         * @since                2.0
56         *
57         * @return               A pointer to the Tizen::Graphics::Bitmap instance generated from the specified file
58         * @param[in]    imagePath                               The relative path starting from the density directory @b "res/screen-density-XXX/" or @b "res/AxB", @n
59         *                                                                               where A and B represent the width and height of the screen of the supported device models, respectively
60         * @exception    E_SUCCESS                               The method is successful.
61         * @exception    E_INVALID_ARG                   The specified input parameter is invalid.
62         * @exception    E_UNSUPPORTED_FORMAT    The image file format is not supported.
63         * @exception    E_FILE_NOT_FOUND                The specified file cannot be found.
64         * @exception    E_SYSTEM                                A system error has occurred.
65         * @remarks      The specific error code can be accessed using the GetLastResult() method.
66         * @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         */
68         virtual Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& imagePath, Tizen::Graphics::BitmapPixelFormat pixelFormat) const;
69
70         static _AppResourceBitmap* Get_AppResourceBitmapN(int type, const Tizen::Base::String& value);
71
72 private:
73         /**
74         * This is the default constructor for this class.
75         */
76         _AppResourceBitmap(void);
77
78         /**
79         * This is the copy constructor for this class.
80         */
81         _AppResourceBitmap(const _AppResourceBitmap& rhs);
82
83         /**
84         * This is the destructor for this class.
85         */
86         virtual ~_AppResourceBitmap(void);
87
88         /**
89          * This is the assignment operator for this class.
90          */
91         _AppResourceBitmap& operator =(const _AppResourceBitmap& rhs);
92
93 private:
94         std::unique_ptr<_AppResourceBitmapUtil> __pAppResourceBitmapUtil;
95
96 }; // _AppResourceBitmap
97
98 }} // Tizen::App
99
100 #endif // _FAPP_INTERNAL_APP_RESOURCE_BITMAP_H_