UIBlurView improvement

This commit is contained in:
Daniil Vinogradov
2024-12-19 02:18:01 +01:00
parent 2d6058c400
commit 37fdbc2874
4 changed files with 10 additions and 1 deletions
+5
View File
@@ -16,9 +16,14 @@ public:
void setBlurValue(NXFloat blurValue);
[[nodiscard]] NXFloat blurValue() const { return _blurValue; }
void setBackgroundTintColor(UIColor backgroundTintColor) { _backgroundTintColor = backgroundTintColor; }
[[nodiscard]] UIColor backgroundTintColor() const { return _backgroundTintColor; }
std::optional<AnimatableProperty> value(std::string forKeyPath) override;
protected:
void update(std::shared_ptr<CALayer> presentation, std::shared_ptr<CABasicAnimation> animation, float progress) override;
UIColor _backgroundTintColor;
private:
NXFloat _blurValue = 10;
+3
View File
@@ -12,6 +12,9 @@ public:
void setBlurValue(NXFloat blurValue) { _blurLayer()->setBlurValue(blurValue); }
[[nodiscard]] NXFloat blurValue() const { return _blurLayer()->blurValue(); }
void setBackgroundTintColor(UIColor backgroundTintColor) { _blurLayer()->setBackgroundTintColor(backgroundTintColor); }
[[nodiscard]] UIColor backgroundTintColor() const { return _blurLayer()->backgroundTintColor(); }
private:
std::shared_ptr<CABlurLayer> _blurLayer() const;
};
+1 -1
View File
@@ -40,7 +40,7 @@ void CABlurLayer::draw(SkCanvas* context) {
context->saveLayer(slr);
context->restore();
context->drawColor(0x40FFFFFF);
context->drawColor(_backgroundTintColor.raw());
context->restore();
}
@@ -155,6 +155,7 @@ void TestViewController::loadView() {
blur->setFrame({ 80, 200, 240, 240 });
rootView->addSubview(blur);
blur->layer()->setCornerRadius(12);
blur->setBackgroundTintColor(0x60DDDDDD);
blur->addSubview(dragMeViewLabel);