LibGfx: Add TintFilter

This is a very simpler filter that tints an image with a color.
This commit is contained in:
MacDue 2022-10-09 16:27:53 +01:00 committed by Sam Atkins
parent 35b714163d
commit 467565e3d4

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/StringView.h>
#include <LibGfx/Filters/ColorFilter.h>
namespace Gfx {
class TintFilter : public ColorFilter {
public:
TintFilter(Color color, float amount)
: ColorFilter(amount)
, m_color(color)
{
}
virtual StringView class_name() const override { return "TintFilter"sv; }
protected:
Color convert_color(Color) override
{
// Note: ColorFilter will blend by amount
return m_color;
};
private:
Gfx::Color m_color;
};
}