mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
PixelPaint: Create Filter base class
All the filters will need a wrapper around them, and this is going to be their base class
This commit is contained in:
parent
0334783cf0
commit
5cf0357be1
3 changed files with 62 additions and 0 deletions
|
@ -17,6 +17,7 @@ set(SOURCES
|
||||||
FilterGallery.cpp
|
FilterGallery.cpp
|
||||||
FilterGalleryGML.h
|
FilterGalleryGML.h
|
||||||
FilterModel.cpp
|
FilterModel.cpp
|
||||||
|
Filters/Filter.cpp
|
||||||
Image.cpp
|
Image.cpp
|
||||||
ImageEditor.cpp
|
ImageEditor.cpp
|
||||||
Layer.cpp
|
Layer.cpp
|
||||||
|
|
28
Userland/Applications/PixelPaint/Filters/Filter.cpp
Normal file
28
Userland/Applications/PixelPaint/Filters/Filter.cpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Filter.h"
|
||||||
|
#include <LibGUI/BoxLayout.h>
|
||||||
|
#include <LibGUI/Label.h>
|
||||||
|
|
||||||
|
namespace PixelPaint {
|
||||||
|
|
||||||
|
RefPtr<GUI::Widget> Filter::get_settings_widget()
|
||||||
|
{
|
||||||
|
if (!m_settings_widget) {
|
||||||
|
m_settings_widget = GUI::Widget::construct();
|
||||||
|
m_settings_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||||
|
|
||||||
|
auto& name_label = m_settings_widget->add<GUI::Label>(filter_name());
|
||||||
|
name_label.set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||||
|
|
||||||
|
m_settings_widget->add<GUI::Widget>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_settings_widget.ptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
33
Userland/Applications/PixelPaint/Filters/Filter.h
Normal file
33
Userland/Applications/PixelPaint/Filters/Filter.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../ImageEditor.h"
|
||||||
|
#include "../Layer.h"
|
||||||
|
#include <LibGUI/Widget.h>
|
||||||
|
|
||||||
|
namespace PixelPaint {
|
||||||
|
|
||||||
|
class Filter {
|
||||||
|
public:
|
||||||
|
virtual void apply() const = 0;
|
||||||
|
virtual RefPtr<GUI::Widget> get_settings_widget();
|
||||||
|
|
||||||
|
virtual StringView filter_name() = 0;
|
||||||
|
|
||||||
|
virtual ~Filter() {};
|
||||||
|
|
||||||
|
Filter(ImageEditor* editor)
|
||||||
|
: m_editor(editor) {};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ImageEditor* m_editor { nullptr };
|
||||||
|
StringView m_filter_name;
|
||||||
|
RefPtr<GUI::Widget> m_settings_widget { nullptr };
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue