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 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.
25 #include <dali/public-api/images/bitmap-image.h>
26 #include <dali/internal/common/message.h>
27 #include <dali/internal/render/gl-resources/texture.h>
28 #include <dali/internal/common/bitmap-upload.h>
29 #include <dali/integration-api/bitmap.h>
30 #include <dali/internal/event/images/bitmap-compressed.h>
31 #include <dali/integration-api/debug.h>
39 class CompressedBitmapTexture;
40 typedef IntrusivePtr<CompressedBitmapTexture> CompressedBitmapTexturePointer;
43 * Compressed Texture class.
44 * If you want to load a file to a CompressedBitmapTexture use
45 * TextureManager::GetTexture()
46 * Compressed textures differ from ordinary ones in that their in-memory
47 * representation cannot be inspected at a pixel level by simple pointer
48 * arithmetic and in that they cannot be partially updated.
50 class CompressedBitmapTexture : public Texture
55 * Creates a new texture object from a Bitmap
56 * @param[in] bitmap The Bitmap
57 * @param context The GL context
59 CompressedBitmapTexture( Internal::BitmapCompressed* const bitmap, Context& context );
64 virtual ~CompressedBitmapTexture();
68 * @copydoc Texture::Init
73 * @copydoc Texture::GetWidth
75 virtual unsigned int GetWidth() const;
78 * @copydoc Texture::GetHeight
80 virtual unsigned int GetHeight() const;
83 * @copydoc Texture::HasAlphaChannel
85 virtual bool HasAlphaChannel() const;
88 * @copydoc Texture::IsFullyOpaque
89 * 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?
91 virtual bool IsFullyOpaque() const;
94 * Bitmap has been reloaded - update the texture appropriately.
95 * @param[in] bitmap The new bitmap
97 virtual void Update( Integration::Bitmap* bitmap );
100 * @return Return true if the texture should be updated on GL texture creation.
102 virtual bool UpdateOnCreate();
106 * @copydoc Texture::CreateGlTexture
108 virtual bool CreateGlTexture();
113 * Assigns the bitmap data to an OpenGL texture
114 * Creates a new texture object and copies
115 * the image data held in the pixels parameter
116 * @param[in] generateTexture True if we should generate a GL texture id
117 * @param[in] pixels The pixel data
119 void AssignBitmap( bool generateTexture, const unsigned char* pixels, const size_t bufferSize );
122 Internal::BitmapCompressedPtr mBitmap; ///< The Bitmap the Texture was created from (may be NULL)
124 // Changes scope, should be at end of class
125 DALI_LOG_OBJECT_STRING_DECLARATION;
127 } //namespace Internal
130 #endif //__DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_H__