1 #ifndef __DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_H__
2 #define __DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_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.
26 #include <dali/public-api/images/buffer-image.h>
27 #include <dali/internal/common/message.h>
28 #include <dali/internal/render/gl-resources/texture.h>
29 #include <dali/internal/render/gl-resources/texture-cache.h>
30 #include <dali/integration-api/bitmap.h>
31 #include <dali/internal/event/images/bitmap-compressed.h>
32 #include <dali/integration-api/debug.h>
40 class CompressedBitmapTexture;
41 typedef IntrusivePtr<CompressedBitmapTexture> CompressedBitmapTexturePointer;
44 * Compressed Texture class.
45 * If you want to load a file to a CompressedBitmapTexture use
46 * TextureManager::GetTexture()
47 * Compressed textures differ from ordinary ones in that their in-memory
48 * representation cannot be inspected at a pixel level by simple pointer
49 * arithmetic and in that they cannot be partially updated.
51 class CompressedBitmapTexture : public Texture
56 * Creates a new texture object from a Bitmap
57 * @param[in] bitmap The Bitmap
58 * @param[in] context The GL context
59 * @param[in] discardPolicy The discard policy
61 CompressedBitmapTexture( Internal::BitmapCompressed* const bitmap, Context& context, ResourcePolicy::Discardable discardPolicy );
66 virtual ~CompressedBitmapTexture();
70 * @copydoc Texture::Init
75 * @copydoc Texture::GetWidth
77 virtual unsigned int GetWidth() const;
80 * @copydoc Texture::GetHeight
82 virtual unsigned int GetHeight() const;
85 * @copydoc Texture::HasAlphaChannel
87 virtual bool HasAlphaChannel() const;
90 * @copydoc Texture::IsFullyOpaque
91 * Always returns false as we can't know what is going on inside the encoded pixel data. ///!Todo: Revise this decision: Paul, didn't you want the opposite assumption?
93 virtual bool IsFullyOpaque() const;
96 * Bitmap has been reloaded - update the texture appropriately.
97 * @param[in] bitmap The new bitmap
99 virtual void Update( Integration::Bitmap* bitmap );
102 * @return Return true if the texture should be updated on GL texture creation.
104 virtual bool UpdateOnCreate();
108 * @copydoc Texture::CreateGlTexture
110 virtual bool CreateGlTexture();
115 * Assigns the bitmap data to an OpenGL texture
116 * Creates a new texture object and copies
117 * the image data held in the pixels parameter
118 * @param[in] generateTexture True if we should generate a GL texture id
119 * @param[in] pixels The pixel data
121 void AssignBitmap( bool generateTexture, const unsigned char* pixels, const size_t bufferSize );
124 Internal::BitmapCompressedPtr mBitmap; ///< The Bitmap the Texture was created from (may be NULL)
125 Pixel::Format mPixelFormat;
127 // Changes scope, should be at end of class
128 DALI_LOG_OBJECT_STRING_DECLARATION;
130 } //namespace Internal
133 #endif //__DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_H__