mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
LibGfx: Preseve original alpha when applying tint filter
This commit is contained in:
parent
db235a87bf
commit
13beed1722
1 changed files with 7 additions and 4 deletions
|
@ -15,17 +15,20 @@ class TintFilter : public ColorFilter {
|
||||||
public:
|
public:
|
||||||
TintFilter(Color color, float amount)
|
TintFilter(Color color, float amount)
|
||||||
: ColorFilter(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; }
|
virtual StringView class_name() const override { return "TintFilter"sv; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Color convert_color(Color) override
|
Color convert_color(Color dest) override
|
||||||
{
|
{
|
||||||
// Note: ColorFilter will blend by amount
|
return Color::from_rgb(dest.value())
|
||||||
return m_color;
|
.mixed_with(m_color, m_amount)
|
||||||
|
.with_alpha(dest.alpha());
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue