AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
Backdrop.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12//
13// Created by alex2 on 29.12.2020.
14//
15
16#pragma once
17
18#include <initializer_list>
19#include "IProperty.h"
20
21namespace ass {
22
32 struct Backdrop {
43
67 int downscale = 1;
68
69
70 [[nodiscard]]
71 bool operator==(const GaussianBlurCustom&) const = default;
72 };
73
84 struct GaussianBlur {
85 AMetric radius;
86
87 [[nodiscard]]
88 API_AUI_VIEWS GaussianBlurCustom findOptimalParams() const;
89 };
90
91 using Any = std::variant<GaussianBlur, GaussianBlurCustom>;
92 using Preprocessed = std::variant<GaussianBlurCustom>;
93 AVector<Any> effects;
94
95 Backdrop(std::initializer_list<Any> effects): effects(std::move(effects)) {}
96 };
97
98 namespace prop {
99 template<>
100 struct API_AUI_VIEWS Property<Backdrop>: IPropertyBase {
101 private:
102 Backdrop mInfo;
103
104 public:
105 Property(const Backdrop& info) : mInfo(info) {
106
107 }
108
109 void renderFor(AView* view, const ARenderContext& ctx) override;
110 bool isNone() override;
111
112 PropertySlot getPropertySlot() const override;
113
114 [[nodiscard]]
115 const auto& value() const noexcept {
116 return mInfo;
117 }
118 };
119
120 }
121}
Stores dimensions in scalable units (dp, pt, etc...).
Definition: AMetric.h:75
A std::vector with AUI extensions.
Definition: AVector.h:38
Base class of all UI objects.
Definition: AView.h:77
Render context passed to AView::render.
Definition: ARenderContext.h:43
Underlying type of GaussianBlur but with customizable downscale. Generally, use GaussianBlur.
Definition: Backdrop.h:36
AMetric radius
blur radius.
Definition: Backdrop.h:42
int downscale
downscale factor. =1 equals don't affect. Must be positive.
Definition: Backdrop.h:67
Fast gaussian blur.
Definition: Backdrop.h:84
Represents backdrop filter effect which applied to the pixels behind the view (i.e....
Definition: Backdrop.h:32
Base class for all properties.
Definition: IPropertyBase.h:49
Definition: IProperty.h:19