From 7e01d06226b326c89c4230a6bba535cb53076164 Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Sun, 1 Aug 2021 15:53:19 +0200 Subject: [PATCH] PixelPaint: Add Guide class This will allow the user to add Guides to the image, that will only be visible in the Editor, not affecting the image. --- Userland/Applications/PixelPaint/Guide.h | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Userland/Applications/PixelPaint/Guide.h diff --git a/Userland/Applications/PixelPaint/Guide.h b/Userland/Applications/PixelPaint/Guide.h new file mode 100644 index 0000000000..dd87ceb0bc --- /dev/null +++ b/Userland/Applications/PixelPaint/Guide.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021, Tobias Christiansen + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace PixelPaint { + +class Guide : public RefCounted { +public: + enum class Orientation { + Vertical, + Horizontal, + }; + + Guide(Orientation orientation, float offset) + : m_orientation(orientation) + , m_offset(offset) + { + } + + static NonnullRefPtr construct(Orientation orientation, float offset) + { + return create(orientation, offset); + }; + + Orientation orientation() const { return m_orientation; } + float offset() const { return m_offset; } + + void set_offset(float offset) { m_offset = offset; } + +private: + Orientation m_orientation; + float m_offset { 0.0 }; +}; + +};