serenity/Userland/Applications/PixelPaint/FilterPreviewWidget.h
Timothy Slater 75c359ef31 PixelPaint: Make filters apply to a selection if one is present
This changes ImageProcessor to use the scratch bitmap of the layer which
will cause the changes to only be applied inside the active selection
(if there is one). This also updates the FilterPreviewWidget to show the
filter preview with active selection taken into account.
2022-11-09 22:13:26 +03:30

38 lines
783 B
C++

/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "Filters/Filter.h"
#include "ImageEditor.h"
#include "Layer.h"
#include <LibGUI/Frame.h>
#include <LibGfx/Bitmap.h>
namespace PixelPaint {
class FilterPreviewWidget final : public GUI::Frame {
C_OBJECT(FilterPreviewWidget);
public:
virtual ~FilterPreviewWidget() override;
void set_layer(RefPtr<Layer> layer);
void set_bitmap(RefPtr<Gfx::Bitmap> const& bitmap);
void set_filter(Filter* filter);
void clear_filter();
private:
explicit FilterPreviewWidget();
RefPtr<Layer> m_layer;
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<Gfx::Bitmap> m_filtered_bitmap;
virtual void paint_event(GUI::PaintEvent&) override;
};
}