X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=adaptors%2Fcommon%2Fpixel-buffer-impl.h;h=e8eb98ecfa3555f27692cdb0ca198a78a59f3d3e;hb=8d61b6699d9f2466af87a35a894fb626fd5bf455;hp=ec7ee2bd18c2c7cfab5f42e19ed8ae77e1ffe07b;hpb=5a2fb8ef5db8cfca879878eb4ca8c84871e5b7af;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/common/pixel-buffer-impl.h b/adaptors/common/pixel-buffer-impl.h index ec7ee2b..e8eb98e 100644 --- a/adaptors/common/pixel-buffer-impl.h +++ b/adaptors/common/pixel-buffer-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ADAPTOR_PIXEL_BUFFER_H /* - * Copyright (c) 2017 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. @@ -23,6 +23,10 @@ #include // For ImageDimensions #include #include +#include + +// EXTERNAL INCLUDES +#include namespace Dali { @@ -140,9 +144,11 @@ public: Dali::PixelData CreatePixelData() const; /** - * Apply the mask to the current buffer. This method may update the - * internal object - e.g. the new buffer may have a different pixel - * format - as an alpha channel may be added. + * @brief Apply the mask to the current buffer. + * + * This method may update the internal object - e.g. the new buffer + * may have a different pixel format - as an alpha channel may be + * added. * @param[in] mask The mask to apply to this pixel buffer * @param[in] contentScale The scaling factor to apply to the content * @param[in] cropToMask Whether to crop the output to the mask size (true) or scale the @@ -150,6 +156,67 @@ public: */ void ApplyMask( const PixelBuffer& mask, float contentScale, bool cropToMask ); + /** + * @brief Apply a Gaussian blur to the current buffer with the given radius. + * + * @param[in] blurRadius The radius for Gaussian blur + */ + void ApplyGaussianBlur( const float blurRadius ); + + /** + * Crops this buffer to the given crop rectangle. Assumes the crop rectangle + * is within the bounds of this size. + * @param[in] x The top left corner's X + * @param[in] y The top left corner's y + * @param[in] cropDimensions The dimensions of the crop + */ + void Crop( uint16_t x, uint16_t y, ImageDimensions cropDimensions ); + + /** + * Resizes the buffer to the given dimensions. Uses either Lanczos4 for downscaling + * or Mitchell for upscaling + * @param[in] outDimensions The new dimensions + */ + void Resize( ImageDimensions outDimensions ); + + /** + * Multiplies the image's color values by the alpha value. This provides better + * blending capability. + */ + void MultiplyColorByAlpha(); + + /** + * @brief Sets image metadata + * + * @param map Property map containing Exif fields + */ + void SetMetadata( const Property::Map& map ); + + /** + * @brief Returns image metadata as a property map + * @param[out] outMetadata Property map to copy the data into + * @return True on success + */ + bool GetMetadata(Property::Map& outMetadata) const; + + /** + * @brief Sets metadata property map for the pixel buffer + * @note The function takes over the ownership of the property map + * @param[in] metadata Property map to copy the data into + */ + void SetMetadata(std::unique_ptr metadata); + + /** + * Allocates fixed amount of memory for the pixel data. Used by compressed formats. + * @param[in] size Size of memory to be allocated + */ + void AllocateFixedSize( uint32_t size ); + + /** + * @copydoc Devel::PixelBuffer::Rotate() + */ + bool Rotate( Degree angle ); + private: /* * Undefined copy constructor. @@ -203,29 +270,14 @@ private: */ static PixelBufferPtr NewResize( const PixelBuffer& inBuffer, ImageDimensions outDimensions ); - /** - * Crops this buffer to the given crop rectangle. Assumes the crop rectangle - * is within the bounds of this size. - * @param[in] x The top left corner's X - * @param[in] y The top left corner's y - * @param[in] cropDimensions The dimensions of the crop - */ - void Crop( uint16_t x, uint16_t y, ImageDimensions cropDimensions ); - - /** - * Resizes the buffer to the given dimensions. Uses either Lanczos4 for downscaling - * or Mitchell for upscaling - * @param[in] outDimensions The new dimensions - */ - void Resize( ImageDimensions outDimensions ); - 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 + std::unique_ptr mMetadata; ///< Metadata fields + 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 }; } // namespace Adaptor