mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:37:44 +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
1 changed files with 35 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue