mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
LibGfx: Add TintFilter
This is a very simpler filter that tints an image with a color.
This commit is contained in:
parent
35b714163d
commit
467565e3d4
35
Userland/Libraries/LibGfx/Filters/TintFilter.h
Normal file
35
Userland/Libraries/LibGfx/Filters/TintFilter.h
Normal 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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue