summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-11-27 14:04:04 +0000
committerLinus Groh <mail@linusgroh.de>2022-11-27 20:35:22 +0100
commit13beed172238ba34d439a7cd0e73141bdecd55ab (patch)
tree631392cb36ce4f2abc1f4a79ee0e23578fc9dd4e
parentdb235a87bf671a64654c33767bbc239f1df52de9 (diff)
downloadserenity-13beed172238ba34d439a7cd0e73141bdecd55ab.zip
LibGfx: Preseve original alpha when applying tint filter
-rw-r--r--Userland/Libraries/LibGfx/Filters/TintFilter.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGfx/Filters/TintFilter.h b/Userland/Libraries/LibGfx/Filters/TintFilter.h
index edc613a013..c471a573a0 100644
--- a/Userland/Libraries/LibGfx/Filters/TintFilter.h
+++ b/Userland/Libraries/LibGfx/Filters/TintFilter.h
@@ -15,17 +15,20 @@ class TintFilter : public ColorFilter {
public:
TintFilter(Color color, float amount)
: ColorFilter(amount)
- , m_color(color)
+ , m_color(Color::from_rgb(color.value()))
{
}
+ virtual bool amount_handled_in_filter() const override { return true; }
+
virtual StringView class_name() const override { return "TintFilter"sv; }
protected:
- Color convert_color(Color) override
+ Color convert_color(Color dest) override
{
- // Note: ColorFilter will blend by amount
- return m_color;
+ return Color::from_rgb(dest.value())
+ .mixed_with(m_color, m_amount)
+ .with_alpha(dest.alpha());
};
private: