IDrawable#
An abstract image that determines itself how it is displayed. Essentially an abstraction from vector and raster graphics.
| Header: | #include <AUI/Image/IDrawable.h> |
| CMake: | aui_link(my_target PUBLIC aui::views) |
Examples#
examples/ui/views/src/ExampleWindow.cpp
Views Example — All-in-one views building example.
LayoutSpacing { 4_dp },
});
addView(Horizontal {
_new<ADrawableView>(IDrawable::fromUrl(":img/logo.svg")) AUI_OVERRIDE_STYLE { FixedSize { 32_dp } },
AText::fromString("Building beautiful programs in pure C++ without chromium embedded framework") AUI_OVERRIDE_STYLE {
Expanding(1, 1),
},
Horizontal {} AUI_LET {
mAsync << AUI_THREADPOOL {
Public Types#
Params#
struct IDrawable::Params
Empty structure.
Public Methods#
draw#
virtual void IDrawable::draw(IRenderer& render, const IDrawable::Params& params)
Called when the image needs to be displayed. It is assumed that the renderer is already set to the desired state (coordinates, color, etc.)
getSizeHint#
- Returns
- Size of the stored image. Can be ignored by the renderer. If the size is unknown, it can be {0, 0}
isDpiDependent#
- Returns
- true if the size hint of this drawable needs to be multiplied by the DPI ratio
rasterize#
virtual AImage IDrawable::rasterize(glm::ivec2 imageSize)
Converts possibly vector drawable to a raster image.
TODO Unimplemented for all drawables except raster image and svg