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.
40 class 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( ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN );
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
92 * See Dali::Integration::Bitmap::GetReleaseFunction()
94 ReleaseFunction GetReleaseFunction(){ return FREE; }
99 * A reference counted object may only be deleted by calling Unreference()
101 virtual ~BitmapCompressed();
105 std::size_t mBufferSize;
107 BitmapCompressed(const BitmapCompressed& other); ///< defined private to prevent use
108 BitmapCompressed& operator = (const BitmapCompressed& other); ///< defined private to prevent use
110 // Changes scope, should be at end of class
111 DALI_LOG_OBJECT_STRING_DECLARATION;
114 } // namespace Integration
118 #endif // __DALI_INTERNAL_COMPRESSED_BITMAP_H__