1 #ifndef __DALI_BITMAP_LOADER_H__
2 #define __DALI_BITMAP_LOADER_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/images/pixel.h>
24 #include <dali/public-api/object/base-handle.h>
33 class BitmapLoader : public BaseHandle
37 * @brief Create an initialized bitmap loader. This will automatically load the image.
39 * @param[in] filename Filename of the bitmap image to load.
41 static BitmapLoader New(const std::string& filename);
44 * @brief Create an empty handle.
46 * Use BitmapLoader::New() to create an initialized object.
56 * @brief This copy constructor is required for (smart) pointer semantics.
58 * @param [in] handle A reference to the copied handle
60 BitmapLoader(const BitmapLoader& handle);
63 * @brief This assignment operator is required for (smart) pointer semantics.
65 * @param [in] rhs A reference to the copied handle
66 * @return A reference to this
68 BitmapLoader& operator=(const BitmapLoader& rhs);
71 * @brief This method is defined to allow assignment of the NULL value,
72 * and will throw an exception if passed any other value.
74 * Assigning to NULL is an alias for Reset().
75 * @param [in] rhs A NULL pointer
76 * @return A reference to this handle
78 BitmapLoader& operator=(BaseHandle::NullType* rhs);
83 * Get the raw pixel data.
84 * @return The pixel data. Use the GetHeight(), GetWidth(), GetStride() and GetPixelFormat() methods
87 unsigned char* GetPixelData() const;
90 * Get the buffer height in pixels
91 * @return the height of the buffer in pixels
93 unsigned int GetImageHeight() const;
96 * Get the buffer width in pixels
97 * @return the width of the buffer in pixels
99 unsigned int GetImageWidth() const;
102 * Get the number of bytes in each row of pixels
103 * @return The buffer stride in bytes.
105 unsigned int GetBufferStride() const;
108 * Get the pixel format of the loaded bitmap.
110 Pixel::Format GetPixelFormat() const;
112 public: // Not intended for application developers
114 explicit DALI_INTERNAL BitmapLoader(Internal::BitmapLoader*);
119 #endif // __DALI_BITMAP_LOADER_H__