Base texture class, subclasses of which depend on the render spec (DX, GL etc.)
More...
#include <Texture.h>
|
| CTexture (unsigned int width=0, unsigned int height=0, XB_FMT format=XB_FMT_A8R8G8B8) |
|
bool | LoadFromMemory (unsigned int width, unsigned int height, unsigned int pitch, XB_FMT format, bool hasAlpha, const unsigned char *pixels) |
|
bool | LoadPaletted (unsigned int width, unsigned int height, unsigned int pitch, XB_FMT format, const unsigned char *pixels, const COLOR *palette) |
|
bool | HasAlpha () const |
|
void | SetAlpha (bool hasAlpha) |
|
void | SetMipmapping () |
|
bool | IsMipmapped () const |
|
void | SetScalingMethod (TEXTURE_SCALING scalingMethod) |
|
TEXTURE_SCALING | GetScalingMethod () const |
|
void | SetCacheMemory (bool bCacheMemory) |
|
bool | GetCacheMemory () const |
|
virtual void | CreateTextureObject ()=0 |
|
virtual void | DestroyTextureObject ()=0 |
|
virtual void | LoadToGPU ()=0 |
|
virtual void | BindToUnit (unsigned int unit)=0 |
|
unsigned char * | GetPixels () const |
|
unsigned int | GetPitch () const |
|
unsigned int | GetRows () const |
|
unsigned int | GetTextureWidth () const |
|
unsigned int | GetTextureHeight () const |
|
unsigned int | GetWidth () const |
|
unsigned int | GetHeight () const |
|
unsigned int | GetOriginalWidth () const |
| return the original width of the image, before scaling/cropping
|
|
unsigned int | GetOriginalHeight () const |
| return the original height of the image, before scaling/cropping
|
|
int | GetOrientation () const |
|
void | SetOrientation (int orientation) |
|
void | Update (unsigned int width, unsigned int height, unsigned int pitch, XB_FMT format, const unsigned char *pixels, bool loadToGPU) |
|
void | Allocate (unsigned int width, unsigned int height, XB_FMT format) |
|
void | ClampToEdge () |
|
|
static std::unique_ptr< CTexture > | CreateTexture (unsigned int width=0, unsigned int height=0, XB_FMT format=XB_FMT_A8R8G8B8) |
|
static std::unique_ptr< CTexture > | LoadFromFile (const std::string &texturePath, unsigned int idealWidth=0, unsigned int idealHeight=0, bool requirePixels=false, const std::string &strMimeType="") |
| Load a texture from a file Loads a texture from a file, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these. More...
|
|
static std::unique_ptr< CTexture > | LoadFromFileInMemory (unsigned char *buffer, size_t bufferSize, const std::string &mimeType, unsigned int idealWidth=0, unsigned int idealHeight=0) |
| Load a texture from a file in memory Loads a texture from a file in memory, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these. More...
|
|
static unsigned int | PadPow2 (unsigned int x) |
|
static bool | SwapBlueRed (unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements=4, unsigned int offset=0) |
|
|
bool | LoadFromFileInMem (unsigned char *buffer, size_t size, const std::string &mimeType, unsigned int maxWidth, unsigned int maxHeight) |
|
bool | LoadFromFileInternal (const std::string &texturePath, unsigned int maxWidth, unsigned int maxHeight, bool requirePixels, const std::string &strMimeType="") |
|
bool | LoadIImage (IImage *pImage, unsigned char *buffer, unsigned int bufSize, unsigned int width, unsigned int height) |
|
unsigned int | GetPitch (unsigned int width) const |
|
unsigned int | GetRows (unsigned int height) const |
|
unsigned int | GetBlockSize () const |
|
|
unsigned int | m_imageWidth |
|
unsigned int | m_imageHeight |
|
unsigned int | m_textureWidth |
|
unsigned int | m_textureHeight |
|
unsigned int | m_originalWidth |
| original image width before scaling or cropping
|
|
unsigned int | m_originalHeight |
| original image height before scaling or cropping
|
|
unsigned char * | m_pixels |
|
bool | m_loadedToGPU |
|
XB_FMT | m_format |
|
int | m_orientation |
|
bool | m_hasAlpha = true |
|
bool | m_mipmapping = false |
|
TEXTURE_SCALING | m_scalingMethod = TEXTURE_SCALING::LINEAR |
|
bool | m_bCacheMemory = false |
|
Base texture class, subclasses of which depend on the render spec (DX, GL etc.)
◆ LoadFromFile()
std::unique_ptr< CTexture > CTexture::LoadFromFile |
( |
const std::string & |
texturePath, |
|
|
unsigned int |
idealWidth = 0 , |
|
|
unsigned int |
idealHeight = 0 , |
|
|
bool |
requirePixels = false , |
|
|
const std::string & |
strMimeType = "" |
|
) |
| |
|
static |
Load a texture from a file Loads a texture from a file, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these.
- Parameters
-
texturePath | the path of the texture to load. |
idealWidth | the ideal width of the texture (defaults to 0, no ideal width). |
idealHeight | the ideal height of the texture (defaults to 0, no ideal height). |
strMimeType | mimetype of the given texture if available (defaults to empty) |
- Returns
- a CTexture std::unique_ptr to the created texture - nullptr if the texture failed to load.
◆ LoadFromFileInMemory()
std::unique_ptr< CTexture > CTexture::LoadFromFileInMemory |
( |
unsigned char * |
buffer, |
|
|
size_t |
bufferSize, |
|
|
const std::string & |
mimeType, |
|
|
unsigned int |
idealWidth = 0 , |
|
|
unsigned int |
idealHeight = 0 |
|
) |
| |
|
static |
Load a texture from a file in memory Loads a texture from a file in memory, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these.
- Parameters
-
buffer | the memory buffer holding the file. |
bufferSize | the size of buffer. |
mimeType | the mime type of the file in buffer. |
idealWidth | the ideal width of the texture (defaults to 0, no ideal width). |
idealHeight | the ideal height of the texture (defaults to 0, no ideal height). |
- Returns
- a CTexture std::unique_ptr to the created texture - nullptr if the texture failed to load.
The documentation for this class was generated from the following files:
- xbmc/guilib/Texture.h
- xbmc/guilib/Texture.cpp
- xbmc/guilib/TextureDX.cpp
- xbmc/guilib/TextureGL.cpp