1 #ifndef __DALI_PIXEL_DATA_H__
2 #define __DALI_PIXEL_DATA_H__
5 * Copyright (c) 2015 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.
21 #include <dali/public-api/images/pixel.h>
22 #include <dali/public-api/object/base-handle.h>
33 * @brief The PixelData object holds a pixel buffer .
35 * The PixelData takes over the ownership of the pixel buffer.
36 * The buffer memory must NOT be released outside of this class, instead, the PixelData object will release it automatically when the reference count falls to zero.
38 class DALI_IMPORT_API PixelData : public BaseHandle
44 FREE, ///< Use free function to release the pixel buffer
45 DELETE_ARRAY, ///< Use delete[] operator to release the pixel buffer
49 * @brief Create a PixelData object.
51 * @param [in] buffer The raw pixel data.
52 * @param [in] width Buffer width in pixels
53 * @param [in] height Buffer height in pixels
54 * @param [in] pixelFormat The pixel format
55 * @param [in] releaseFunction The function used to release the memory.
57 static PixelData New( unsigned char* buffer,
60 Pixel::Format pixelFormat,
61 ReleaseFunction releaseFunction);
64 * @brief Create an empty handle.
66 * Use PixelData::New() to create an initialized object.
76 * @brief This copy constructor is required for (smart) pointer semantics.
78 * @param [in] handle A reference to the copied handle
80 PixelData(const PixelData& handle);
83 * @brief This assignment operator is required for (smart) pointer semantics.
85 * @param [in] rhs A reference to the copied handle
86 * @return A reference to this
88 PixelData& operator=(const PixelData& rhs);
91 * Get the width of the buffer in pixels.
92 * @return The width of the buffer in pixels
94 unsigned int GetWidth() const;
97 * Get the height of the buffer in pixels
98 * @return The height of the buffer in pixels
100 unsigned int GetHeight() const;
103 * Get the pixel format
104 * @return The pixel format
106 Pixel::Format GetPixelFormat() const;
108 public: // Not intended for application developers
110 explicit DALI_INTERNAL PixelData( Internal::PixelData* );
116 #endif // __DALI_PIXEL_DATA_H__