1 #ifndef __DALI_BITMAP_METADATA_H__
2 #define __DALI_BITMAP_METADATA_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.
22 #include <dali/integration-api/bitmap.h>
23 #include <dali/public-api/images/pixel.h>
24 #include <dali/public-api/images/native-image-interface.h>
38 * Creates a BitmapMetadata object from a native image (eg.: EGLImage).
39 * @param[in] nativeImage The native image to load
40 * @return A newly allocated BitmapMetadata
42 static BitmapMetadata New(NativeImageInterfacePtr nativeImage);
45 * Creates a new BitmapMetadata object from a Bitmap
46 * @param[in] bitmap The bitmap
47 * @return A newly allocated BitmapMetadata
49 static BitmapMetadata New(Integration::Bitmap* const bitmap);
52 * Creates a new BitmapMetadata object from framebuffer metadata
53 * @return A newly allocated BitmapMetadata
55 static BitmapMetadata New(unsigned int width, unsigned int height, bool hasAlphaChannel);
60 BitmapMetadata( unsigned int width, unsigned int height, bool hasAlphaChanne, bool opaqueness );
65 BitmapMetadata( const BitmapMetadata& rhs );
70 BitmapMetadata& operator=( const BitmapMetadata& rhs );
78 * Updates the metadata with information from the native image
79 * @param[in] nativeImage The native image that was updated
81 void Update(NativeImageInterfacePtr nativeImage);
84 * Updates the metadata with information from the bitmap
85 * @param[in] bitmap The bitmap that was updated
87 void Update(Integration::Bitmap* const bitmap);
90 * Return the width of image in pixels.
93 unsigned int GetWidth() const;
96 * Return the height of image in pixels.
99 unsigned int GetHeight() const;
102 * Query whether the texture data has an alpha channel.
103 * @return True if the texture data has an alpha channel.
105 bool HasAlphaChannel() const;
108 * Query whether the texture is completely opaque
109 * @return True if all pixels of the texture data are opaque
111 bool IsFullyOpaque() const;
114 * Set the width of image
115 * @param[in] width The width of the image
117 void SetWidth(unsigned int width);
120 * Set the height of image
121 * @param[in] height The height of the image in pixels
123 void SetHeight(unsigned int height);
126 * Set whether the texture has alpha channel
127 * @param[in] hasAlphaChannel whether the texture has alpha channel
129 void SetHasAlphaChannel( bool hasAlphaChannel );
132 * Set whether the texture is completely opaque, i.e.
133 * true if all pixels of the texture data are opaque.
134 * @param[in] opaqueness If the alpha channel is set to fully opaque.
136 void SetOpaqueness(bool opaqueness);
138 void SetIsNativeImage( bool isNativeImage );
139 bool GetIsNativeImage( );
140 void SetIsFramebuffer( bool isFramebuffer );
141 bool GetIsFramebuffer( );
144 unsigned int mImageWidth; ///< width of the original image
145 unsigned int mImageHeight; ///< height of the original image
146 bool mHasAlphaChannel:1; ///< Pixel format of the contained image data.
147 bool mOpaqueness:1; ///< Whether the bitmap was fully opaque when loaded / updated
148 bool mIsNativeImage:1; ///< Whether the image is native or not
149 bool mIsFramebuffer:1; ///< Whether the image is an FBO
152 } // namespace Internal
156 #endif // __DALI_BITMAP_METADATA_H__