Cocos2d-x  v4
TextureBackend Class Referenceabstract

A base texture. More...

Inherits Ref.

Inherited by Texture2DBackend, and TextureCubemapBackend.

Public Member Functions

virtual void updateSamplerDescriptor (const SamplerDescriptor &sampler)=0
 Update sampler. More...
 
virtual void getBytes (std::size_t x, std::size_t y, std::size_t width, std::size_t height, bool flipImage, std::function< void(const unsigned char *, std::size_t, std::size_t)> callback)=0
 Read a block of pixels from the drawable texture. More...
 
virtual void generateMipmaps ()=0
 Generate mipmaps.
 
virtual void updateTextureDescriptor (const TextureDescriptor &descriptor)
 Update texture description. More...
 
PixelFormat getTextureFormat () const
 Get texture format. More...
 
TextureUsage getTextureUsage () const
 Get texture usage. More...
 
TextureType getTextureType () const
 Get texture type. More...
 
bool hasMipmaps () const
 Check if mipmap had generated before. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

A base texture.

Member Function Documentation

◆ updateSamplerDescriptor()

virtual void updateSamplerDescriptor ( const SamplerDescriptor &  sampler)
pure virtual

Update sampler.

Parameters
samplerSpecifies the sampler descriptor.

Implemented in TextureCubeGL, TextureCubeMTL, Texture2DGL, and TextureMTL.

◆ getBytes()

virtual void getBytes ( std::size_t  x,
std::size_t  y,
std::size_t  width,
std::size_t  height,
bool  flipImage,
std::function< void(const unsigned char *, std::size_t, std::size_t)>  callback 
)
pure virtual

Read a block of pixels from the drawable texture.

Parameters
x,ySpecify the window coordinates of the first pixel that is read from the drawable texture. This location is the lower left corner of a rectangular block of pixels.
width,heightSpecify the dimensions of the pixel rectangle. width and height of one correspond to a single pixel.
flipImageSpecifies if needs to flip the image.
callbackSpecifies a call back function to deal with the image.

Implemented in TextureCubeGL, TextureCubeMTL, Texture2DGL, and TextureMTL.

◆ updateTextureDescriptor()

virtual void updateTextureDescriptor ( const TextureDescriptor descriptor)
virtual

Update texture description.

Parameters
descriptorSpecifies texture and sampler descriptor.

Reimplemented in TextureCubeGL, Texture2DGL, TextureCubeMTL, and TextureMTL.

◆ getTextureFormat()

PixelFormat getTextureFormat ( ) const
inline

Get texture format.

Returns
Texture format.

◆ getTextureUsage()

TextureUsage getTextureUsage ( ) const
inline

Get texture usage.

Symbolic constant can be READ, WRITE or RENDER_TARGET.

Returns
Texture usage.

◆ getTextureType()

TextureType getTextureType ( ) const
inline

Get texture type.

Symbolic constant value can be either TEXTURE_2D or TEXTURE_CUBE.

Returns
Texture type.

◆ hasMipmaps()

bool hasMipmaps ( ) const
inline

Check if mipmap had generated before.

Returns
true if the mipmap has always generated before, otherwise false.

The documentation for this class was generated from the following file: