Skip to content

ass::BackgroundImage#

Represents textured (image) background.

Header:#include <AUI/ASS/Property/BackgroundImage.h>
CMake:aui_link(my_target PUBLIC aui::views)

Public fields and Signals#


dpiMargin#

unset_wrap<float> dpiMargin

DPI multiplier used to underscale or upperscale the icon.

In example, you may use 64x64 png icons and set the dpiMargin to 2.0. They will be rendered as 32px icons on 100% scale (instead of 64px), and 64px on 200% scale, remaining crisp. On 300% scale, however, they will be rendered as 96px images, thus becoming blurry, hence usage of SVG icons is recommended.


image#

unset_wrap<std::variant<AString,_<IDrawable>>> image

Url to the image.

In example, ":icon.svg" references to icon.svg file in your assets. See AUrl for more info.

Examples#

examples/app/game_of_life/src/main.cpp

Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.

        if (!mTexture) {
            mTexture = AWindow::current()->getRenderingContext()->renderer().getNewTexture();
        }

        CellsImage image(mCells->size());
        for (unsigned y = 0; y < image.height(); ++y) {
            for (unsigned x = 0; x < image.width(); ++x) {
                image.set(
                    { x, y },
                    AFormattedColorConverter(

overlayColor#

unset_wrap<AColor> overlayColor

Multiply color filter to the image.

It allows to replace the color of white icons to the specified overlayColor.

Gray color multiplied by the specified one gives the darker color.

Black color is not affected.


rep#

unset_wrap<Repeat> rep

Repeating. See Repeat


scale#

unset_wrap<glm::vec2> scale

Scale of the image by x and y axis. Default is { 1.0, 1.0 }.

Examples#

examples/app/fractal/src/JumpToCoordsWindow.cpp

Fractal Example - Fractal viewer application demonstrating usage of custom shaders.

JumpToCoordsWindow::JumpToCoordsWindow(_<FractalView> fractalView, AWindow* parent)
  : AWindow("Jump to coords", 854_dp, 500_dp, parent, WindowStyle::NO_RESIZE) {
    auto re = _new<ATextField>();
    auto im = _new<ATextField>();
    auto scale = _new<ATextField>();

    auto pos = fractalView->getPlotPosition();
    re->setText(AString::number(pos.x));
    im->setText(AString::number(pos.y));
    scale->setText(AString::number(fractalView->getPlotScale()));
examples/app/fractal/src/FractalView.cpp

Fractal Example - Fractal viewer application demonstrating usage of custom shaders.

    AView::onScroll(event);
    auto projectedPos = (glm::dvec2(event.origin) / glm::dvec2(getSize()) - glm::dvec2(0.5)) * 2.0;
    projectedPos.x *= mAspectRatio;
    mTransform = glm::translate(mTransform, glm::vec3 { projectedPos, 0.0 });
    mTransform = glm::scale(mTransform, glm::vec3(1.0 - event.delta.y / 1000.0));
    mTransform = glm::translate(mTransform, -glm::vec3 { projectedPos, 0.0 });

    handleMatrixUpdated();

    redraw();

sizing#

unset_wrap<Sizing> sizing

Sizing. See ass::Sizing