Stellarium 0.12.2
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
StelTextureBackend Class Reference

Base class for texture implementations. More...

#include <StelTextureBackend.hpp>

Public Member Functions

virtual ~StelTextureBackend ()
 Destroy the texture. More...
 
TextureStatus getStatus () const
 Get the current texture status. More...
 
const QString & getName () const
 Get the "name" of this texture. More...
 
QSize getDimensions () const
 Get texture dimensions in pixels. More...
 
const QString & getErrorMessage () const
 Get a human-readable message describing the error that happened during loading (if any). More...
 

Protected Member Functions

 StelTextureBackend (const QString &path)
 Construct a StelTextureBackend with specified texture path/url. More...
 
void startedLoading ()
 Must be called before loading an image (whether normally or asynchronously). More...
 
void finishedLoading (const QSize dimensions)
 Must be called after succesfully loading an image (whether normally or asynchronously). More...
 
void errorOccured (const QString &error)
 Must be called when an error occurs during loading. More...
 

Protected Attributes

const QString path
 Full file system path or URL of the texture file. More...
 

Detailed Description

Base class for texture implementations.

Note
This is an internal class of the Renderer subsystem and should not be used elsewhere.
See Also
StelTextureNew

Definition at line 95 of file StelTextureBackend.hpp.

Constructor & Destructor Documentation

virtual StelTextureBackend::~StelTextureBackend ( )
inlinevirtual

Destroy the texture.

Definition at line 101 of file StelTextureBackend.hpp.

StelTextureBackend::StelTextureBackend ( const QString &  path)
inlineprotected

Construct a StelTextureBackend with specified texture path/url.

Note that it makes no sense to instantiate StelTextureBackend itself - it needs to be derived by a backend.

Definition at line 157 of file StelTextureBackend.hpp.

Member Function Documentation

void StelTextureBackend::errorOccured ( const QString &  error)
inlineprotected

Must be called when an error occurs during loading.

Texture loading is the only stage when an error may occur (i.e. the texture can't just become invalid at any time). Asserts that status is loading, changes it to error, and specifies error message.

Definition at line 200 of file StelTextureBackend.hpp.

void StelTextureBackend::finishedLoading ( const QSize  dimensions)
inlineprotected

Must be called after succesfully loading an image (whether normally or asynchronously).

At this point, texture size is initialized and becomes valid. Asserts that status is loading and changes it to loaded.

Parameters
dimensionsSize of loaded texture in pixels.

Definition at line 185 of file StelTextureBackend.hpp.

QSize StelTextureBackend::getDimensions ( ) const
inline

Get texture dimensions in pixels.

Can only be called when the texture has been successfully loaded (this is asserted). Use getStatus() to determine whether or not this is the case.

Returns
Texture width and height in pixels.

Definition at line 130 of file StelTextureBackend.hpp.

const QString& StelTextureBackend::getErrorMessage ( ) const
inline

Get a human-readable message describing the error that happened during loading (if any).

Returns
Error message if status is TextureStatus_Error, empty string otherwise.

Definition at line 143 of file StelTextureBackend.hpp.

const QString& StelTextureBackend::getName ( ) const
inline

Get the "name" of this texture.

The name might be the full path if loaded from file, URL if loaded from network, or nothing at all when generated.

Definition at line 118 of file StelTextureBackend.hpp.

TextureStatus StelTextureBackend::getStatus ( ) const
inline

Get the current texture status.

Used e.g. to determine if the texture has been loaded or if an error has occured.

Returns
texture status.

Definition at line 109 of file StelTextureBackend.hpp.

void StelTextureBackend::startedLoading ( )
inlineprotected

Must be called before loading an image (whether normally or asynchronously).

Asserts that status is uninitialized and changes it to loading.

Definition at line 170 of file StelTextureBackend.hpp.

Member Data Documentation

const QString StelTextureBackend::path
protected

Full file system path or URL of the texture file.

Definition at line 151 of file StelTextureBackend.hpp.


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