|
ClanLib
2.3.7
|
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... | |
Image class.
| 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.
| 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.
| 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.
| 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.
| context | = Graphic Context |
| filename | Filename 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.
| context | = Graphic Context |
| filename | Filename 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.
| context | = Graphic Context |
| resource_id | Resource name of the image resource |
| resources | Resource manager used to load resource |
| import_desc | = Image Import Description |
|
virtual |
| void CL_Image::draw | ( | CL_GraphicContext & | gc, |
| float | x, | ||
| float | y | ||
| ) | const |
Draw image on graphic context.
| x,y | Anchor position of where to render image. Actual rendering position depends on the anchor and the alignment mode. |
| gc | Graphic context on which to render upon. |
| void CL_Image::draw | ( | CL_GraphicContext & | gc, |
| int | x, | ||
| int | y | ||
| ) | const |
Draw image on graphic context.
| x,y | Anchor position of where to render image. Actual rendering position depends on the anchor and the alignment mode. |
| gc | Graphic 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.
| gc | Graphic context on which to render upon. |
| src | Source rectangle to draw. Use this is draw only part of the image. |
| dest | Rectangle to draw image in. |
| void CL_Image::draw | ( | CL_GraphicContext & | gc, |
| const CL_Rectf & | dest | ||
| ) | const |
Draw image on graphic context.
| gc | Graphic context on which to render upon. |
| dest | Rectangle 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.
| int CL_Image::get_width | ( | ) | const |
Return the width of the image.
|
inline |
Returns true if this object is invalid.
|
inline |
Inequality operator.
|
inline |
Less than operator.
|
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).
|
inline |
Set color.
| c | = Color |
References CL_Colorf::a, CL_Colorf::b, CL_Colorf::g, CL_Color::get_alpha(), CL_Color::get_blue(), CL_Color::get_green(), CL_Color::get_red(), CL_Colorf::r, and set_color().
Referenced by set_color().
| 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.
| image | Image to upload. |
| level | Mipmap 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.
1.8.4