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 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.
24 #include <dali/integration-api/bitmap.h>
31 class BitmapCompressed;
32 typedef IntrusivePtr<BitmapCompressed> BitmapCompressedPtr;
35 * BitmapCompressed class.
36 * A container for image data that remains in compresssed form as an opaque blob
37 * in memory rather than being decompressed at load time.
38 * Used for formats that are supported as GLES texture data directly.
39 * \sa{Bitmap BitmapPackedPixel BitmapExternal}
41 class DALI_IMPORT_API BitmapCompressed : public Dali::Integration::Bitmap, Dali::Integration::Bitmap::CompressedProfile
46 * @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
48 BitmapCompressed( ResourcePolicy::Discardable discardable = ResourcePolicy::RETAIN );
50 virtual const Bitmap::CompressedProfile* GetCompressedProfile() const { return this; }
51 virtual Bitmap::CompressedProfile* GetCompressedProfile() { return this; }
55 * Initializes internal class members
56 * @param[in] pixelFormat pixel format
57 * @param[in] width Image width in pixels
58 * @param[in] height Image height in pixels
59 * @param[in] bufferSize Buffer cpacity in pixels
61 void Initialize(Pixel::Format pixelFormat,
64 const std::size_t bufferSize);
67 * (Re-)Allocate pixel buffer for the Bitmap. Any previously allocated pixel buffer
69 * Dali has ownership of the buffer, and contents are opaque and immutable.
70 * Bitmap stores given size information about the image which the client is assumed
71 * to have retrieved from out-of-band image metadata.
72 * @param[in] pixelFormat pixel format
73 * @param[in] width Image width in pixels
74 * @param[in] height Image height in pixels
75 * @param[in] bufferSize Buffer size in bytes
76 * @return pixel buffer pointer
78 virtual Dali::Integration::PixelBuffer* ReserveBufferOfSize( Pixel::Format pixelFormat,
80 const unsigned height,
81 const std::size_t numBytes );
84 * Get the pixel buffer size in bytes
85 * @return The buffer size in bytes.
87 virtual std::size_t GetBufferSize() const
95 * A reference counted object may only be deleted by calling Unreference()
97 virtual ~BitmapCompressed();
101 std::size_t mBufferSize;
103 BitmapCompressed(const BitmapCompressed& other); ///< defined private to prevent use
104 BitmapCompressed& operator = (const BitmapCompressed& other); ///< defined private to prevent use
106 // Changes scope, should be at end of class
107 DALI_LOG_OBJECT_STRING_DECLARATION;
110 } // namespace Integration
114 #endif // __DALI_INTERNAL_COMPRESSED_BITMAP_H__