32#include "../../Core/Math/origin.h"
33#include "../../Core/Resources/resource.h"
35#include "../Image/image_import_description.h"
36#include "../Render/texture.h"
52 class ResourceManager;
53 class XMLResourceDocument;
111 explicit operator bool()
const {
return bool(impl); }
150 return impl == other.impl;
156 return impl != other.impl;
162 return impl < other.impl;
185 const Rectf &dest)
const;
193 const Rectf &dest)
const;
203 const Quadf &dest)
const;
211 const Quadf &dest)
const;
254 const Rect &src_rect,
258 std::shared_ptr<Image_Impl> impl;
2D Graphics Canvas
Definition canvas.h:72
Color description class.
Definition color.h:46
Floating point color description class (for float).
Definition color.h:799
Virtual File System (VFS).
Definition file_system.h:47
Image Import Description Class.
Definition image_import_description.h:48
Image class.
Definition image.h:59
Image(Canvas &canvas, const std::string &filename, const ImageImportDescription &import_desc=ImageImportDescription())
Constructs a Image.
void get_alignment(Origin &origin, float &x, float &y) const
Returns translation hot-spot.
float get_scale_y() const
Returns y scale.
Colorf get_color() const
Returns current color.
float get_height() const
Return the height of the image.
static Image load(Canvas &canvas, const std::string &id, const XMLResourceDocument &doc)
Loads a Sprite from a XML resource definition.
void draw(Canvas &canvas, const Rectf &src, const Quadf &dest) const
Draw image on graphic context.
float get_alpha() const
Returns current alpha.
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 filte...
Image()
Constructs a null instance.
bool is_null() const
Returns true if this object is invalid.
Definition image.h:110
void set_scale(float x, float y)
Set scale for x and y directions individually.
void draw(Canvas &canvas, const Rectf &dest) const
Draw image on graphic context.
void set_subimage(Canvas &canvas, int x, int y, const PixelBuffer &image, const Rect &src_rect, int level=0)
Image(Subtexture &sub_texture)
Constructs an image from a subtexture.
bool operator!=(const Image &other) const
Inequality operator.
Definition image.h:154
static Resource< Image > resource(Canvas &canvas, const std::string &id, const ResourceManager &resources)
Retrieves a Sprite resource from the resource manager.
Image(Canvas &canvas, const PixelBuffer &pixelbuffer, const Rect &rect)
Constructs a Image from a pixelbuffer.
float get_width() const
Return the width of the image.
Subtexture get_texture() const
Return the texture of the image.
bool operator<(const Image &other) const
Less than operator.
Definition image.h:160
Image clone() const
Copies all information from this image to another, excluding the graphics that remain shared.
void draw(Canvas &canvas, const Quadf &dest) const
Draw image on graphic context.
void set_wrap_mode(TextureWrapMode wrap_s, TextureWrapMode wrap_t)
Image(Canvas &canvas, const std::string &filename, const FileSystem &fs, const ImageImportDescription &import_desc=ImageImportDescription())
Constructs a Image.
void set_color(const Color &c)
Set color.
Definition image.h:228
bool operator==(const Image &other) const
Equality operator.
Definition image.h:148
Image(Texture2D texture, const Rect &rect)
Constructs an image from a texture.
void draw(Canvas &canvas, float x, float y) const
Draw image on graphic context.
float get_scale_x() const
Returns x scale.
void set_alpha(float alpha)
Sets transparency.
void draw(Canvas &canvas, const Rectf &src, const Rectf &dest) const
Draw image on graphic context.
void set_alignment(Origin origin, float x=0, float y=0)
Sets translation hotspot.
void set_color(const Colorf &color)
Sets the color.
void throw_if_null() const
Throw an exception if this object is invalid.
Sizef get_size() const
Return the size of the image.
Pixel data container.
Definition pixel_buffer.h:68
2D quad structure - Float
Definition quad.h:217
2D (left,top,right,bottom) rectangle structure - Integer
Definition rect.h:489
2D (left,top,right,bottom) rectangle structure - Float
Definition rect.h:503
Resource manager.
Definition resource_manager.h:44
Resource proxy of a specific type.
Definition resource.h:58
2D (width,height) size structure - Float
Definition size.h:184
Sub-texture description.
Definition subtexture.h:45
2D texture object class.
Definition texture_2d.h:41
XML Resource Document.
Definition xml_resource_document.h:48
Origin
Alignment origins.
Definition origin.h:39
TextureWrapMode
Texture coordinate wrapping modes.
Definition texture.h:65