AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
IDrawable Class Referenceabstract

An abstract image that determines itself how it is displayed. Essentially an abstraction from vector and raster graphics. More...

#include <AUI/Image/IDrawable.h>

Classes

struct  Params
 

Public Member Functions

virtual AImage rasterize (glm::ivec2 imageSize)
 Converts possibly vector drawable to a raster image.
 
virtual void draw (IRenderer &render, const IDrawable::Params &params)=0
 Called when the image needs to be displayed. It is assumed that the renderer is already set to the desired state (coordinates, color, etc.)
 
virtual glm::ivec2 getSizeHint ()=0
 
virtual bool isDpiDependent () const
 

Static Public Member Functions

static API_AUI_VIEWS _< IDrawablefromUrl (const AUrl &url) noexcept
 Creates a drawable from an url.
 

Detailed Description

An abstract image that determines itself how it is displayed. Essentially an abstraction from vector and raster graphics.

Member Function Documentation

◆ draw()

virtual void IDrawable::draw ( IRenderer & render,
const IDrawable::Params & params )
pure virtual

Called when the image needs to be displayed. It is assumed that the renderer is already set to the desired state (coordinates, color, etc.)

Implemented in AAnimatedDrawable, AImageDrawable, ANoiseDrawable, and AVectorDrawable.

◆ fromUrl()

_< IDrawable > IDrawable::fromUrl ( const AUrl & url)
staticnoexcept

Creates a drawable from an url.

Parameters
urlurl to create a drawable from
Returns
drawable instance or null

If some kind of error occurs during loading the drawable, a log entry [Drawable] is outputted with detailed description of an error. The reason is we don't want to crash our application if we didn't loaded some graphics, which is usually pretty optional stuff. The user can still do his job with the application without fancy images.

◆ getSizeHint()

virtual glm::ivec2 IDrawable::getSizeHint ( )
pure virtual
Returns
Size of the stored image. Can be ignored by the renderer. If the size is unknown, it can be {0, 0}

Implemented in AAnimatedDrawable, AImageDrawable, ANoiseDrawable, and AVectorDrawable.

◆ isDpiDependent()

virtual bool IDrawable::isDpiDependent ( ) const
inlinevirtual
Returns
true if the size hint of this drawable needs to be multiplied by the DPI ratio

Reimplemented in AVectorDrawable.

◆ rasterize()

AImage IDrawable::rasterize ( glm::ivec2 imageSize)
virtual

Converts possibly vector drawable to a raster image.

Parameters
imageSizeimage size
Returns
rasterized image

TODO Unimplemented for all drawables except raster image and svg

Reimplemented in AImageDrawable, and AVectorDrawable.


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