ClanLib  2.3.7
List of all members
CL_Image Class Reference

Image class. More...

#include <image.h>

Public Member Functions

Construction
 CL_Image ()
 Constructs a null instance. More...
 
 CL_Image (CL_GraphicContext &context, CL_Texture texture, CL_Rect rect)
 Constructs an image from a texture. More...
 
 CL_Image (CL_GraphicContext &context, CL_Subtexture &sub_texture)
 Constructs an image from a subtexture. More...
 
 CL_Image (CL_GraphicContext &gc, const CL_PixelBuffer &pixelbuffer, const CL_Rect &rect)
 Constructs a Image from a pixelbuffer. More...
 
 CL_Image (CL_GraphicContext &context, const CL_StringRef &filename, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Constructs a Image. More...
 
 CL_Image (CL_GraphicContext &context, const CL_StringRef &filename, CL_VirtualDirectory &dir, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Constructs a Image. More...
 
 CL_Image (CL_GraphicContext &context, const CL_StringRef &resource_id, CL_ResourceManager *resources, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Constructs a Image. More...
 
virtual ~CL_Image ()
 
Attributes
bool is_null () const
 Returns true if this object is invalid. More...
 
void throw_if_null () const
 Throw an exception if this object is invalid. More...
 
float get_scale_x () const
 Returns x scale. More...
 
float get_scale_y () const
 Returns y scale. More...
 
float get_alpha () const
 Returns current alpha. More...
 
CL_Colorf get_color () const
 Returns current color. More...
 
void get_alignment (CL_Origin &origin, int &x, int &y) const
 Returns translation hot-spot. More...
 
CL_Size get_size () const
 Get Size. More...
 
int get_width () const
 Return the width of the image. More...
 
int get_height () const
 Return the height of the image. More...
 
Operators
bool operator== (const CL_Image &other) const
 Equality operator. More...
 
bool operator!= (const CL_Image &other) const
 Inequality operator. More...
 
bool operator< (const CL_Image &other) const
 Less than operator. More...
 
Operations
void draw (CL_GraphicContext &gc, float x, float y) const
 Draw image on graphic context. More...
 
void draw (CL_GraphicContext &gc, int x, int y) const
 Draw image on graphic context. More...
 
void draw (CL_GraphicContext &gc, const CL_Rectf &src, const CL_Rectf &dest) const
 Draw image on graphic context. More...
 
void draw (CL_GraphicContext &gc, const CL_Rectf &dest) const
 Draw image on graphic context. More...
 
void set_scale (float x, float y)
 Set scale for x and y directions individually. More...
 
void set_alpha (float alpha)
 Sets transparency. More...
 
void set_color (const CL_Colorf &color)
 Sets the color. More...
 
void set_color (const CL_Color &c)
 Set color. More...
 
void set_alignment (CL_Origin origin, int x=0, int y=0)
 Sets translation hotspot. More...
 
void set_wrap_mode (CL_TextureWrapMode wrap_s, CL_TextureWrapMode wrap_t)
 
void set_linear_filter (bool linear_filter=true)
 Set to true if a linear filter should be used for scaling up and down, false if a nearest-point filter should be used. More...
 
void set_subimage (int x, int y, const CL_PixelBuffer &image, const CL_Rect &src_rect, int level=0)
 Upload image to sub texture. More...
 

Detailed Description

Image class.

Constructor & Destructor Documentation

CL_Image::CL_Image ( )

Constructs a null instance.

CL_Image::CL_Image ( CL_GraphicContext context,
CL_Texture  texture,
CL_Rect  rect 
)

Constructs an image from a texture.

Parameters
context= Graphic Context
texture= Texture to get image data from
rect= Position and size in texture to get image data from
CL_Image::CL_Image ( CL_GraphicContext context,
CL_Subtexture sub_texture 
)

Constructs an image from a subtexture.

Parameters
context= Graphic Context
sub_texture= Subtexture to get image data from
CL_Image::CL_Image ( CL_GraphicContext gc,
const CL_PixelBuffer pixelbuffer,
const CL_Rect rect 
)

Constructs a Image from a pixelbuffer.

Parameters
gc= Graphic Context
pixelbuffer= Pixelbuffer to get image data from
rect= pixelbuffer rect
CL_Image::CL_Image ( CL_GraphicContext context,
const CL_StringRef filename,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Constructs a Image.

Parameters
context= Graphic Context
filenameFilename of image to load
import_desc= Image Import Description
CL_Image::CL_Image ( CL_GraphicContext context,
const CL_StringRef filename,
CL_VirtualDirectory dir,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Constructs a Image.

Parameters
context= Graphic Context
filenameFilename of image to load
dir= Virtual directory to load filename from
import_desc= Image Import Description
CL_Image::CL_Image ( CL_GraphicContext context,
const CL_StringRef resource_id,
CL_ResourceManager resources,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Constructs a Image.

Parameters
context= Graphic Context
resource_idResource name of the image resource
resourcesResource manager used to load resource
import_desc= Image Import Description
virtual CL_Image::~CL_Image ( )
virtual

Member Function Documentation

void CL_Image::draw ( CL_GraphicContext gc,
float  x,
float  y 
) const

Draw image on graphic context.

Parameters
x,yAnchor position of where to render image. Actual rendering position depends on the anchor and the alignment mode.
gcGraphic context on which to render upon.
void CL_Image::draw ( CL_GraphicContext gc,
int  x,
int  y 
) const

Draw image on graphic context.

Parameters
x,yAnchor position of where to render image. Actual rendering position depends on the anchor and the alignment mode.
gcGraphic context on which to render upon.
void CL_Image::draw ( CL_GraphicContext gc,
const CL_Rectf src,
const CL_Rectf dest 
) const

Draw image on graphic context.

Parameters
gcGraphic context on which to render upon.
srcSource rectangle to draw. Use this is draw only part of the image.
destRectangle to draw image in.
void CL_Image::draw ( CL_GraphicContext gc,
const CL_Rectf dest 
) const

Draw image on graphic context.

Parameters
gcGraphic context on which to render upon.
destRectangle to draw image in.
void CL_Image::get_alignment ( CL_Origin origin,
int &  x,
int &  y 
) const

Returns translation hot-spot.

float CL_Image::get_alpha ( ) const

Returns current alpha.

Alpha 0.0f is full transparency, and 1.0f is full visibility (solid).

CL_Colorf CL_Image::get_color ( ) const

Returns current color.

Alpha 0.0f is full transparency, and 1.0f is full visibility (solid).

int CL_Image::get_height ( ) const

Return the height of the image.

float CL_Image::get_scale_x ( ) const

Returns x scale.

1.0f is normal scale, 2.0f is twice the size, etc.

float CL_Image::get_scale_y ( ) const

Returns y scale.

1.0f is normal scale, 2.0f is twice the size, etc.

CL_Size CL_Image::get_size ( ) const

Get Size.

Returns
size
int CL_Image::get_width ( ) const

Return the width of the image.

bool CL_Image::is_null ( ) const
inline

Returns true if this object is invalid.

bool CL_Image::operator!= ( const CL_Image other) const
inline

Inequality operator.

bool CL_Image::operator< ( const CL_Image other) const
inline

Less than operator.

bool CL_Image::operator== ( const CL_Image other) const
inline

Equality operator.

void CL_Image::set_alignment ( CL_Origin  origin,
int  x = 0,
int  y = 0 
)

Sets translation hotspot.

void CL_Image::set_alpha ( float  alpha)

Sets transparency.

Alpha 0.0f is full transparency, and 1.0f is full visibility (solid).

void CL_Image::set_color ( const CL_Colorf color)

Sets the color.

Alpha 0.0f is full transparency, and 1.0f is full visibility (solid).

void CL_Image::set_color ( const CL_Color c)
inline
void CL_Image::set_linear_filter ( bool  linear_filter = true)

Set to true if a linear filter should be used for scaling up and down, false if a nearest-point filter should be used.

void CL_Image::set_scale ( float  x,
float  y 
)

Set scale for x and y directions individually.

1.0f is normal scale, 2.0f is twice the size, etc.

void CL_Image::set_subimage ( int  x,
int  y,
const CL_PixelBuffer image,
const CL_Rect src_rect,
int  level = 0 
)

Upload image to sub texture.

Parameters
imageImage to upload.
levelMipmap level-of-detail number.
void CL_Image::set_wrap_mode ( CL_TextureWrapMode  wrap_s,
CL_TextureWrapMode  wrap_t 
)
void CL_Image::throw_if_null ( ) const

Throw an exception if this object is invalid.


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