AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
IDrawable Class Referenceabstract

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

Detailed Description

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

Classes

struct  Params
 

Public Member Functions

virtual AImage rasterize (glm::ivec2 imageSize)
 Converts possibly vector drawable to a raster image. More...
 
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.) More...
 
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. More...
 

Friends

class AImageLoaderRegistry
 
class ::Cache< IDrawable, Cache, AUrl >
 

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, AVectorDrawable, AImageDrawable, and ANoiseDrawable.

◆ 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, AVectorDrawable, AImageDrawable, and ANoiseDrawable.

◆ 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 AVectorDrawable, and AImageDrawable.

#include <AUI/Image/IDrawable.h>


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