1 #ifndef DALI_INTERNAL_COMPRESSED_BITMAP_H
2 #define DALI_INTERNAL_COMPRESSED_BITMAP_H
5 * Copyright (c) 2021 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>
30 class BitmapCompressed;
31 using BitmapCompressedPtr = IntrusivePtr<BitmapCompressed>;
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.
39 class BitmapCompressed : public Dali::Integration::Bitmap, Dali::Integration::Bitmap::CompressedProfile
44 * @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
46 BitmapCompressed(ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN);
48 const Bitmap::CompressedProfile* GetCompressedProfile() const override
52 Bitmap::CompressedProfile* GetCompressedProfile() override
59 * Initializes internal class members
60 * @param[in] pixelFormat pixel format
61 * @param[in] width Image width in pixels
62 * @param[in] height Image height in pixels
63 * @param[in] bufferSize Buffer cpacity in pixels
65 void Initialize(Pixel::Format pixelFormat,
72 * (Re-)Allocate pixel buffer for the Bitmap. Any previously allocated pixel buffer
74 * Dali has ownership of the buffer, and contents are opaque and immutable.
75 * Bitmap stores given size information about the image which the client is assumed
76 * to have retrieved from out-of-band image metadata.
77 * @param[in] pixelFormat pixel format
78 * @param[in] width Image width in pixels
79 * @param[in] height Image height in pixels
80 * @param[in] bufferSize Buffer size in bytes
81 * @return pixel buffer pointer
83 Dali::Integration::PixelBuffer* ReserveBufferOfSize(Pixel::Format pixelFormat,
85 const uint32_t height,
86 const uint32_t numBytes) override;
89 * Get the pixel buffer size in bytes
90 * @return The buffer size in bytes.
92 uint32_t GetBufferSize() const override
98 * See Dali::Integration::Bitmap::GetReleaseFunction()
100 ReleaseFunction GetReleaseFunction() override
107 * A reference counted object may only be deleted by calling Unreference()
109 ~BitmapCompressed() override;
112 uint32_t mBufferSize;
114 BitmapCompressed(const BitmapCompressed& other); ///< defined private to prevent use
115 BitmapCompressed& operator=(const BitmapCompressed& other); ///< defined private to prevent use
117 // Changes scope, should be at end of class
118 DALI_LOG_OBJECT_STRING_DECLARATION;
121 } // namespace Internal
125 #endif // DALI_INTERNAL_COMPRESSED_BITMAP_H