Dali 3D User Interface Engine
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
Dali::Internal::NativeTexture Class Reference

Native texture class. More...

#include <native-texture.h>

Inheritance diagram for Dali::Internal::NativeTexture:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::NativeTexture:
Collaboration graph
[legend]

Public Member Functions

 NativeTexture (NativeImageInterface *nativeImg, Context &context)
 Constructor. More...
 
virtual ~NativeTexture ()
 Destructor. More...
 
virtual bool Bind (GLenum target, TextureUnit textureunit)
 Binds the texture for use. More...
 
virtual bool IsFullyOpaque () const
 Query whether the texture is completely opaque. More...
 
virtual bool HasAlphaChannel () const
 Query whether the texture data has an alpha channel. More...
 
virtual bool Init ()
 Initialization method for Texture. More...
 
- Public Member Functions inherited from Dali::Internal::Texture
virtual void Update (Integration::Bitmap *bitmap)
 Update the texture with the bitmap. More...
 
virtual void UpdateArea (const RectArea &area)
 Update the texture from the modified bitmap. More...
 
virtual void Update (Integration::Bitmap *srcBitmap, std::size_t xOffset, std::size_t yOffset)
 Update part of the texture with a different bitmap. More...
 
virtual void Update (PixelData *srcPixelData, std::size_t xOffset, std::size_t yOffset)
 Update part of the texture with a pixel buffer. More...
 
virtual bool UpdateOnCreate ()
 
unsigned int GetTextureId ()
 Returns GL texture ID. More...
 
virtual unsigned int GetWidth () const
 Return the width of image in pixels. More...
 
virtual unsigned int GetHeight () const
 Return the height of image in pixels. More...
 
void SetTextureId (GLuint id)
 Sets the texture id. More...
 
void ApplySampler (TextureUnit unit, unsigned int samplerBitfield)
 Apply the given sampler to the texture. More...
 
virtual ~Texture ()
 Destructor. More...
 
virtual void GlContextDestroyed ()
 Reset all GL resources. More...
 
- Public Member Functions inherited from Dali::RefObject
void Reference ()
 Increment the object's reference count. More...
 
void Unreference ()
 Decrement the object's reference count. More...
 
int ReferenceCount ()
 Retrieve the object's reference count. More...
 
- Public Member Functions inherited from Dali::Internal::GlResourceOwner
virtual ~GlResourceOwner ()
 Virtual destructor. More...
 

Protected Member Functions

virtual bool CreateGlTexture ()
 Initialize texture for rendering. More...
 
virtual void GlCleanup ()
 Release all GL resources. More...
 
- Protected Member Functions inherited from Dali::Internal::Texture
 Texture (Context &context, unsigned int width, unsigned int height, unsigned int imageWidth, unsigned int imageHeight)
 Constructor. More...
 
 Texture (Context &context, unsigned int width, unsigned int height)
 Constructor. More...
 
- Protected Member Functions inherited from Dali::RefObject
 RefObject ()
 Default constructor. More...
 
virtual ~RefObject ()
 RefObject is intended as a base class. More...
 
 RefObject (const RefObject &rhs)
 Copy constructor. More...
 
RefObjectoperator= (const RefObject &rhs)
 Assignment operator. More...
 

Private Attributes

NativeImageInterfacePtr mNativeImage
 reference to NativeImage the Texture was created from More...
 

Additional Inherited Members

- Public Types inherited from Dali::Internal::Texture
typedef Rect< int > PixelArea
 Used to define the area of the texture to display. More...
 
typedef Rect< unsigned int > RectArea
 Used to define a region of a bitmap. More...
 
- Protected Attributes inherited from Dali::Internal::Texture
ContextmContext
 The GL Context. More...
 
GLuint mId
 Texture id. More...
 
unsigned int mSamplerBitfield
 The packed bitfield of the current sampler. More...
 
unsigned int mWidth
 texture width, may be scaled power of 2 (if not in an atlas) More...
 
unsigned int mHeight
 texture width, may be scaled power of 2 (if not in an atlas) More...
 
unsigned int mImageWidth
 width of the original image (may be smaller than texture width) More...
 
unsigned int mImageHeight
 height of the original image (may be smaller than texture height) More...
 

Detailed Description

Native texture class.

Used for handing already loaded image data to Dali.

Definition at line 40 of file native-texture.h.

Constructor & Destructor Documentation

Dali::Internal::NativeTexture::NativeTexture ( NativeImageInterface nativeImg,
Context context 
)

Constructor.

Precondition
nativeImg has to be initialized. (GLTexture is already created)
Parameters
nativeImgthe NativeImage to be used
contextthe GL context

Definition at line 33 of file native-texture.cpp.

References DALI_LOG_INFO.

Dali::Internal::NativeTexture::~NativeTexture ( )
virtual

Destructor.

Definition at line 44 of file native-texture.cpp.

References DALI_LOG_INFO.

Member Function Documentation

bool Dali::Internal::NativeTexture::Bind ( GLenum  target,
TextureUnit  textureunit 
)
virtual

Binds the texture for use.

If there is no GL texture yet, it tries to create one.

Parameters
target(e.g. GL_TEXTURE_2D)
textureunitto bind to
Returns
True if the opengl texture was created, false if there was already a texture or no texture could be created yet ( e.g. no bitmap data after context loss )

Reimplemented from Dali::Internal::Texture.

Definition at line 51 of file native-texture.cpp.

References Dali::Internal::Context::ActiveTexture(), Dali::Internal::Context::Bind2dTexture(), CreateGlTexture(), Dali::Internal::Texture::mContext, Dali::Internal::Texture::mId, mNativeImage, and Dali::NativeImageInterface::PrepareTexture().

Here is the call graph for this function:

bool Dali::Internal::NativeTexture::CreateGlTexture ( )
protectedvirtual
void Dali::Internal::NativeTexture::GlCleanup ( )
protectedvirtual

Release all GL resources.

This means releasing buffer objects, textures. etc Context can be used, unless GlContextDestroyed has been called

Precondition
This method can only be called from the render-thread.

Reimplemented from Dali::Internal::Texture.

Definition at line 110 of file native-texture.cpp.

References DALI_ASSERT_DEBUG, Dali::Internal::Texture::GlCleanup(), Dali::NativeImageInterface::GlExtensionDestroy(), mNativeImage, and Dali::IntrusivePtr< T >::Reset().

Here is the call graph for this function:

bool Dali::Internal::NativeTexture::HasAlphaChannel ( ) const
virtual

Query whether the texture data has an alpha channel.

Returns
True if the texture data has an alpha channel.

Implements Dali::Internal::Texture.

Definition at line 75 of file native-texture.cpp.

References mNativeImage, and Dali::NativeImageInterface::RequiresBlending().

Referenced by IsFullyOpaque().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Dali::Internal::NativeTexture::Init ( )
virtual

Initialization method for Texture.

Might or might not be needed in specific implementations.

Returns
true if successful, false otherwise

Implements Dali::Internal::Texture.

Definition at line 120 of file native-texture.cpp.

Referenced by Dali::Internal::TextureFactory::NewNativeImageTexture().

Here is the caller graph for this function:

bool Dali::Internal::NativeTexture::IsFullyOpaque ( ) const
virtual

Query whether the texture is completely opaque.

Returns
True if all pixels of the texture data are opaque

Implements Dali::Internal::Texture.

Definition at line 70 of file native-texture.cpp.

References HasAlphaChannel().

Here is the call graph for this function:

Member Data Documentation

NativeImageInterfacePtr Dali::Internal::NativeTexture::mNativeImage
private

reference to NativeImage the Texture was created from

Definition at line 90 of file native-texture.h.

Referenced by Bind(), CreateGlTexture(), GlCleanup(), and HasAlphaChannel().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali