mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
LibGfx: Preseve original alpha when applying tint filter
This commit is contained in:
parent
db235a87bf
commit
13beed1722
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/13beed1722 Pull-request: https://github.com/SerenityOS/serenity/pull/16226
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue