1 #ifndef DALI_PIXEL_DATA_H
2 #define DALI_PIXEL_DATA_H
5 * Copyright (c) 2016 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 .
34 * The PixelData takes over the ownership of the pixel buffer.
35 * 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.
39 class DALI_IMPORT_API PixelData : public BaseHandle
45 FREE, ///< Use free function to release the pixel buffer @SINCE_1_1.43
46 DELETE_ARRAY, ///< Use delete[] operator to release the pixel buffer @SINCE_1_1.43
50 * @brief Create a PixelData object.
53 * @param[in] buffer The raw pixel data.
54 * @param[in] bufferSize The size of the buffer in bytes
55 * @param[in] width Buffer width in pixels
56 * @param[in] height Buffer height in pixels
57 * @param[in] pixelFormat The pixel format
58 * @param[in] releaseFunction The function used to release the memory.
60 static PixelData New( unsigned char* buffer,
61 unsigned int bufferSize,
64 Pixel::Format pixelFormat,
65 ReleaseFunction releaseFunction);
68 * @brief Create an empty handle.
69 * Use PixelData::New() to create an initialized object.
83 * @brief This copy constructor is required for (smart) pointer semantics.
86 * @param[in] handle A reference to the copied handle
88 PixelData(const PixelData& handle);
91 * @brief This assignment operator is required for (smart) pointer semantics.
94 * @param[in] rhs A reference to the copied handle
95 * @return A reference to this object
97 PixelData& operator=(const PixelData& rhs);
100 * Get the width of the buffer in pixels.
103 * @return The width of the buffer in pixels
105 unsigned int GetWidth() const;
108 * Get the height of the buffer in pixels
111 * @return The height of the buffer in pixels
113 unsigned int GetHeight() const;
116 * Get the pixel format
119 * @return The pixel format
121 Pixel::Format GetPixelFormat() const;
126 * @brief The constructor
127 * @note Not intended for application developers.
129 * @param[in] pointer A pointer to a newly allocated PixelData
131 explicit DALI_INTERNAL PixelData( Internal::PixelData* pointer );
137 #endif // DALI_PIXEL_DATA_H