1 #ifndef DALI_PIXEL_DATA_DEVEL_H
2 #define DALI_PIXEL_DATA_DEVEL_H
5 * Copyright (c) 2017 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/images/pixel-data.h>
25 #include <dali/devel-api/images/pixel-devel.h>
30 namespace DevelPixelData
34 * @brief Creates a PixelData object, using development pixel formats
36 * @param[in] buffer The raw pixel data
37 * @param[in] bufferSize The size of the buffer in bytes
38 * @param[in] width Buffer width in pixels
39 * @param[in] height Buffer height in pixels
40 * @param[in] pixelFormat The pixel format
41 * @param[in] releaseFunction The function used to release the memory
42 * @return A handle to the PixelData
44 DALI_IMPORT_API PixelData New( unsigned char* buffer,
45 unsigned int bufferSize,
48 DevelPixel::Format pixelFormat,
49 PixelData::ReleaseFunction releaseFunction );
52 * Struct to keep the buffer pointer and the allocation method.
54 * @note Need to find a better solution - one library should not
55 * be freeing data from a different source with potentially
56 * different allocators.
58 struct PixelDataBuffer
60 unsigned char* buffer;
61 unsigned int bufferSize;
62 PixelData::ReleaseFunction releaseFunction;
64 PixelDataBuffer( unsigned char* buffer,
65 unsigned int bufferSize,
66 PixelData::ReleaseFunction releaseFunction )
68 bufferSize(bufferSize),
69 releaseFunction(releaseFunction)
75 * Get the buffer from a pixel data object, zero it in the pixel data object
76 * and release the handle.
77 * @param[in,out] pixelData The pixel data object to take the buffer from
78 * @return the buffer and the data release mechanism
80 PixelDataBuffer ReleasePixelDataBuffer( PixelData& pixelData );
82 } // namespace DevelPixelData
86 #endif // DALI_PIXEL_DATA_DEVEL_H