Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Image Class Reference

Defines a class for loading and storing images. More...

#include <image.h>

Inheritance diagram for Image:
Resource SubImage

Public Member Functions

 ~Image () override
 
int getWidth () const
 Returns the width of the image.
 
int getHeight () const
 Returns the height of the image.
 
void setAlpha (float alpha)
 Sets the alpha value of this image.
 
float getAlpha () const
 Returns the alpha value of this image.
 
ImagegetSubImage (int x, int y, int width, int height)
 Creates a new image with the desired clipping rectangle.
 
- Public Member Functions inherited from Resource
 Resource ()=default
 
void incRef ()
 Increments the internal reference count.
 
void decRef (OrphanPolicy orphanPolicy=DeleteLater)
 Decrements the reference count.
 
const std::string & getIdPath () const
 Return the path identifying this resource.
 

Static Public Member Functions

static Resourceload (SDL_RWops *rw)
 Loads an image from an SDL_RWops structure.
 
static Resourceload (SDL_RWops *rw, const Dye &dye)
 Loads an image from an SDL_RWops structure and recolors it.
 
static Imageload (SDL_Surface *)
 Loads an image from an SDL surface.
 
static bool useOpenGL ()
 Tells if the system is using OpenGL or SDL.
 
static void SDLdisableTransparency ()
 Disable the transparency handling (for low CPUs in SDL Mode)
 
static bool SDLisTransparencyDisabled ()
 
static void setRenderer (SDL_Renderer *renderer)
 

Protected Member Functions

 Image (SDL_Texture *texture, int width, int height)
 SDL Constructor.
 
- Protected Member Functions inherited from Resource
virtual ~Resource ()=default
 

Static Protected Member Functions

static Image_SDLload (SDL_Surface *tmpImage)
 SDL_Surface to SDL_Texture Image loader.
 

Protected Attributes

SDL_Rect mBounds
 
float mAlpha = 1.0f
 
SDL_Texture * mTexture = nullptr
 

Static Protected Attributes

static bool mDisableTransparency = false
 Stores whether the transparency is disabled.
 
static SDL_Renderer * mRenderer
 

Friends

class SDLGraphics
 

Additional Inherited Members

- Public Types inherited from Resource
enum  OrphanPolicy { DeleteLater , DeleteImmediately }
 

Detailed Description

Defines a class for loading and storing images.

Definition at line 44 of file image.h.

Constructor & Destructor Documentation

◆ ~Image()

Image::~Image ( )
override

Definition at line 81 of file image.cpp.

◆ Image()

Image::Image ( SDL_Texture *  texture,
int  width,
int  height 
)
protected

SDL Constructor.

Definition at line 49 of file image.cpp.

Member Function Documentation

◆ _SDLload()

Image * Image::_SDLload ( SDL_Surface *  tmpImage)
staticprotected

SDL_Surface to SDL_Texture Image loader.

Definition at line 184 of file image.cpp.

◆ getAlpha()

float Image::getAlpha ( ) const
inline

Returns the alpha value of this image.

Definition at line 106 of file image.h.

◆ getHeight()

int Image::getHeight ( ) const
inline

Returns the height of the image.

Definition at line 89 of file image.h.

◆ getSubImage()

Image * Image::getSubImage ( int  x,
int  y,
int  width,
int  height 
)

Creates a new image with the desired clipping rectangle.

Returns
NULL if creation failed and a valid object otherwise.

Definition at line 331 of file image.cpp.

◆ getWidth()

int Image::getWidth ( ) const
inline

Returns the width of the image.

Definition at line 83 of file image.h.

◆ load() [1/3]

Resource * Image::load ( SDL_RWops *  rw)
static

Loads an image from an SDL_RWops structure.

Parameters
rwThe SDL_RWops to load the image from.
Returns
NULL if an error occurred, a valid pointer otherwise.

Definition at line 98 of file image.cpp.

◆ load() [2/3]

Resource * Image::load ( SDL_RWops *  rw,
const Dye dye 
)
static

Loads an image from an SDL_RWops structure and recolors it.

Parameters
rwThe SDL_RWops to load the image from.
dyeThe dye used to recolor the image.
Returns
NULL if an error occurred, a valid pointer otherwise.

Definition at line 114 of file image.cpp.

◆ load() [3/3]

Image * Image::load ( SDL_Surface *  tmpImage)
static

Loads an image from an SDL surface.

Definition at line 158 of file image.cpp.

◆ SDLdisableTransparency()

static void Image::SDLdisableTransparency ( )
inlinestatic

Disable the transparency handling (for low CPUs in SDL Mode)

Definition at line 122 of file image.h.

◆ SDLisTransparencyDisabled()

static bool Image::SDLisTransparencyDisabled ( )
inlinestatic

Definition at line 125 of file image.h.

◆ setAlpha()

void Image::setAlpha ( float  alpha)

Sets the alpha value of this image.

Definition at line 176 of file image.cpp.

◆ setRenderer()

void Image::setRenderer ( SDL_Renderer *  renderer)
static

Definition at line 193 of file image.cpp.

◆ useOpenGL()

bool Image::useOpenGL ( )
static

Tells if the system is using OpenGL or SDL.

Returns
true if OpenGL, false if SDL.

Definition at line 167 of file image.cpp.

Friends And Related Symbol Documentation

◆ SDLGraphics

friend class SDLGraphics
friend

Definition at line 46 of file image.h.

Member Data Documentation

◆ mAlpha

float Image::mAlpha = 1.0f
protected

Definition at line 154 of file image.h.

◆ mBounds

SDL_Rect Image::mBounds
protected

Definition at line 153 of file image.h.

◆ mDisableTransparency

bool Image::mDisableTransparency = false
staticprotected

Stores whether the transparency is disabled.

Definition at line 169 of file image.h.

◆ mRenderer

SDL_Renderer * Image::mRenderer
staticprotected

Definition at line 171 of file image.h.

◆ mTexture

SDL_Texture* Image::mTexture = nullptr
protected

Definition at line 166 of file image.h.


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