1 #ifndef __DALI_INTERNAL_COMPRESSED_BITMAP_H__
2 #define __DALI_INTERNAL_COMPRESSED_BITMAP_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
23 #include <dali/integration-api/bitmap.h>
30 class BitmapCompressed;
31 typedef IntrusivePtr<BitmapCompressed> BitmapCompressedPtr;
34 * BitmapCompressed class.
35 * A container for image data that remains in compresssed form as an opaque blob
36 * in memory rather than being decompressed at load time.
37 * Used for formats that are supported as GLES texture data directly.
38 * \sa{Bitmap BitmapPackedPixel BitmapExternal}
40 class DALI_IMPORT_API BitmapCompressed : public Dali::Integration::Bitmap, Dali::Integration::Bitmap::CompressedProfile
45 * @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
47 BitmapCompressed( bool discardable = false );
49 virtual const Bitmap::CompressedProfile* GetCompressedProfile() const { return this; }
50 virtual Bitmap::CompressedProfile* GetCompressedProfile() { return this; }
54 * Initializes internal class members
55 * @param[in] pixelFormat pixel format
56 * @param[in] width Image width in pixels
57 * @param[in] height Image height in pixels
58 * @param[in] bufferSize Buffer cpacity in pixels
60 void Initialize(Pixel::Format pixelFormat,
63 const std::size_t bufferSize);
66 * (Re-)Allocate pixel buffer for the Bitmap. Any previously allocated pixel buffer
68 * Dali has ownership of the buffer, and contents are opaque and immutable.
69 * Bitmap stores given size information about the image which the client is assumed
70 * to have retrieved from out-of-band image metadata.
71 * @param[in] pixelFormat pixel format
72 * @param[in] width Image width in pixels
73 * @param[in] height Image height in pixels
74 * @param[in] bufferSize Buffer size in bytes
75 * @return pixel buffer pointer
77 virtual Dali::Integration::PixelBuffer* ReserveBufferOfSize( Pixel::Format pixelFormat,
79 const unsigned height,
80 const std::size_t numBytes );
83 * Get the pixel buffer size in bytes
84 * @return The buffer size in bytes.
86 virtual std::size_t GetBufferSize() const
94 * A reference counted object may only be deleted by calling Unreference()
96 virtual ~BitmapCompressed();
100 std::size_t mBufferSize;
102 BitmapCompressed(const BitmapCompressed& other); ///< defined private to prevent use
103 BitmapCompressed& operator = (const BitmapCompressed& other); ///< defined private to prevent use
105 // Changes scope, should be at end of class
106 DALI_LOG_OBJECT_STRING_DECLARATION;
109 } // namespace Integration
113 #endif // __DALI_INTERNAL_COMPRESSED_BITMAP_H__