mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03: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
Notes:
sideshowbarker
2024-07-17 06:06:52 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/467565e3d4 Pull-request: https://github.com/SerenityOS/serenity/pull/15524
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 New Issue
Block a user