Stellarium 0.12.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · File Structure

StelTextureBackend Class Reference

Base class for texture implementations. More...

#include <StelTextureBackend.hpp>

List of all members.

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

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 94 of file StelTextureBackend.hpp.


Constructor & Destructor Documentation

virtual StelTextureBackend::~StelTextureBackend (  )  [inline, virtual]

Destroy the texture.

Definition at line 100 of file StelTextureBackend.hpp.

StelTextureBackend::StelTextureBackend ( const QString &  path  )  [inline, protected]

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 156 of file StelTextureBackend.hpp.


Member Function Documentation

void StelTextureBackend::errorOccured ( const QString &  error  )  [inline, protected]

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 199 of file StelTextureBackend.hpp.

void StelTextureBackend::finishedLoading ( const QSize  dimensions  )  [inline, protected]

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:
dimensions Size of loaded texture in pixels.

Definition at line 184 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 129 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 142 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 117 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 108 of file StelTextureBackend.hpp.

void StelTextureBackend::startedLoading (  )  [inline, protected]

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

Asserts that status is uninitialized and changes it to loading.

Definition at line 169 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 150 of file StelTextureBackend.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Jan 31 14:05:47 2013 for Stellarium by  doxygen 1.6.3