#define DALI_INTERNAL_PIXEL_DATA_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/object/base-object.h>
+#include <dali/devel-api/images/pixel-data-devel.h>
namespace Dali
{
{
class PixelData;
-typedef IntrusivePtr<PixelData> PixelDataPtr;
+using PixelDataPtr = IntrusivePtr<PixelData>;
class PixelData : public BaseObject
{
* @param [in] pixelFormat The pixel format
* @param [in] releaseFunction The function used to release the memory.
*/
- static PixelDataPtr New( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
+ static PixelDataPtr New( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat,
Dali::PixelData::ReleaseFunction releaseFunction);
* @param [in] pixelFormat The pixel format
* @param [in] releaseFunction The function used to release the memory.
*/
- PixelData( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
+ PixelData( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat,
Dali::PixelData::ReleaseFunction releaseFunction );
*
* Release the pixel buffer if exists.
*/
- ~PixelData();
+ ~PixelData() override;
public:
* Get the width of the buffer in pixels.
* @return The width of the buffer in pixels
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* Get the height of the buffer in pixels
* @return The height of the buffer in pixels
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
/**
* Get the pixel format
* Get the pixel buffer if it's present.
* @return The buffer if exists, or NULL if there is no pixel buffer.
*/
- unsigned char* GetBuffer() const;
+ uint8_t* GetBuffer() const;
/**
* Get the size of the buffer in bytes
* @return The size of the buffer
*/
- unsigned int GetBufferSize() const;
+ uint32_t GetBufferSize() const;
/**
- * Apply the mask to this data
- * @param[in] mask The mask to apply
+ * Return the buffer pointer and reset the internal buffer to zero.
+ * @return The buffer pointer and associated data.
*/
- void ApplyMask( const PixelData& mask );
+ DevelPixelData::PixelDataBuffer ReleaseBuffer();
private:
- /**
- * Release the buffer
- */
- void ReleaseBuffer();
-
- /**
- * Apply the mask to this data's alpha channel
- * @param[in] mask The mask to apply
- */
- void ApplyMaskToAlphaChannel( const PixelData& mask );
-
- /**
- * Convert to RGBA8888 and apply the mask's alpha channel
- * to this data's alpha channel
- * @param[in] mask The mask to apply
- */
- void AddAlphaChannel( const PixelData& mask );
- /**
- * Apply the mask to this data's color channels (e.g. to apply vignette)
- * @param[in] mask The mask to apply
- */
- void ApplyMaskToColorChannels( const PixelData& mask );
-
- /**
- * Read a weighted sample from a pixel (of unknown size)
- * @param[in] x The x coordinate to sample from
- * @param[in] y The y coordinate to sample from
- */
- float ReadWeightedSample( float x, float y ) const;
-
- /*
+ /*
* Undefined copy constructor.
*/
PixelData(const PixelData& other);
/*
* Undefined assignment operator.
*/
- PixelData& operator= (const PixelData& other);
+ PixelData& operator = (const PixelData& other);
private:
- unsigned char* mBuffer; ///< The raw pixel data
- unsigned int mBufferSize; ///< Buffer sized in bytes
- unsigned int mWidth; ///< Buffer width in pixels
- unsigned int mHeight; ///< Buffer height in pixels
- Pixel::Format mPixelFormat; ///< Pixel format
+ uint8_t* mBuffer; ///< The raw pixel data
+ uint32_t mBufferSize; ///< Buffer sized in bytes
+ uint32_t mWidth; ///< Buffer width in pixels
+ uint32_t mHeight; ///< Buffer height in pixels
+ Pixel::Format mPixelFormat; ///< Pixel format
Dali::PixelData::ReleaseFunction mReleaseFunction; ///< Function for releasing memory
};