ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Image Class Reference

Image to display either on an OpenGL- or plain SDL-Surface. More...

#include <image.h>

Public Member Functions

 Image (bool autoconvert=true)
 Constructor. Does some init. More...
 
 Image (const String &fname, bool autoconvert=true)
 
 ~Image ()
 
void clear ()
 Clears the Image and frees all resources. More...
 
void load (const String &fname, bool autoconvert, uchar alpha=255)
 loads an Image into a SDL_Surface More...
 
void load (const String &fname, uchar alpha=255)
 
void convert ()
 converts an Image to Screenformat More...
 
bool hasAlpha () const
 has alphachannel? More...
 
bool hasColorKey () const
 has colorkey? RGB(255, 0, 255) More...
 
Uint16 width () const
 
Uint16 height () const
 
const Sizesize () const
 
void setAutoConvert (bool autoconvert)
 
void setAlpha (uchar alpha=255)
 
void setColorKey (Color color)
 
Color pixel (const Point &pos)
 
SDL_Surface * surface ()
 
void * pixels ()
 
GLuint texNum () const
 
bool hasTexture () const
 
GLuint textureWidth () const
 
GLuint textureHeight () const
 

Protected Member Functions

void checkAlpha ()
 checks the surface for Alpha More...
 
void checkColorKey ()
 checks the surface for ColorKey More...
 
void genTexture ()
 
void calcTexSize ()
 
void clearTexture ()
 
void clearSurface ()
 

Private Attributes

SDL_Surface * mSurface
 
Color mColorKey
 
bool mHasAlpha
 
bool mHasColorKey
 
bool mIsConverted
 
bool mAutoConvert
 
Size mSize
 
GLuint mTextureWidth
 
GLuint mTextureHeight
 
GLuint mTexNum
 

Detailed Description

Image to display either on an OpenGL- or plain SDL-Surface.

Constructor & Destructor Documentation

Image ( bool  autoconvert = true)

Constructor. Does some init.

References Image::clear(), Image::mAutoConvert, Image::mSurface, and Image::mTexNum.

Image ( const String fname,
bool  autoconvert = true 
)
~Image ( )

References Image::clear().

Member Function Documentation

void calcTexSize ( )
protected
void checkAlpha ( )
protected

checks the surface for Alpha

References Color::a(), Size::height(), Image::mHasAlpha, Image::mSize, Image::mSurface, Size::width(), x, and y.

Referenced by Image::convert(), and Image::textureHeight().

void checkColorKey ( )
protected
void clear ( )
void clearSurface ( )
protected
void clearTexture ( )
protected
void convert ( )
void genTexture ( )
protected
bool hasAlpha ( ) const
inline

has alphachannel?

Returns
true if there is an alphachannel

References Image::mHasAlpha.

Referenced by CanvasGL::image().

bool hasColorKey ( ) const
inline

has colorkey? RGB(255, 0, 255)

Returns
true if there is a colorkey

References Image::mHasColorKey.

bool hasTexture ( ) const
inline

References Image::mTexNum.

Referenced by Image::clearTexture(), and Image::genTexture().

Uint16 height ( ) const
inline
Returns
the height

References Size::height(), and Image::mSize.

Referenced by ImageFont::ImageFont().

void load ( const String fname,
bool  autoconvert,
uchar  alpha = 255 
)

loads an Image into a SDL_Surface

Parameters
fnamethe filename to lo:ad

References Image::convert(), EXCSDL, Image::mAutoConvert, Image::mSize, Image::mSurface, and Size::set().

Referenced by Image::Image(), ImageFont::load(), and Image::load().

void load ( const String fname,
uchar  alpha = 255 
)
Color pixel ( const Point pos)
inline

References Image::mSurface, and Point::y.

Referenced by ImageFont::ImageFont().

void* pixels ( )
inline

References Image::mSurface.

void setAlpha ( uchar  alpha = 255)
inline

References Image::mSurface.

void setAutoConvert ( bool  autoconvert)
inline

sets whether or not autoconvert to screenformat

Parameters
autoconvert= should be converted automatically?

References Image::mAutoConvert.

void setColorKey ( Color  color)
inline

References Image::mColorKey.

const Size& size ( ) const
inline
Returns
the Size

References Image::mSize.

Referenced by Canvas::image(), and Label::setImage().

SDL_Surface* surface ( )
inline

References Image::mSurface.

Referenced by Image::convert(), and CanvasStd::image().

GLuint texNum ( ) const
inline

References Image::mTexNum.

Referenced by CanvasGL::image().

GLuint textureHeight ( ) const
inline
GLuint textureWidth ( ) const
inline

References Image::mTextureWidth.

Referenced by CanvasGL::image().

Uint16 width ( ) const
inline
Returns
the width

References Image::mSize, and Size::width().

Referenced by ImageFont::ImageFont().

Member Data Documentation

bool mAutoConvert
private
Color mColorKey
private
bool mHasAlpha
private
bool mHasColorKey
private
bool mIsConverted
private

Referenced by Image::clear(), and Image::convert().

Size mSize
private
SDL_Surface* mSurface
private
GLuint mTexNum
private
GLuint mTextureHeight
private
GLuint mTextureWidth
private

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