mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
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.
This commit is contained in:
parent
61a1122c2d
commit
7e01d06226
Notes:
sideshowbarker
2024-07-18 07:22:49 +09:00
Author: https://github.com/TobyAsE Commit: https://github.com/SerenityOS/serenity/commit/7e01d06226b Pull-request: https://github.com/SerenityOS/serenity/pull/9155 Reviewed-by: https://github.com/alimpfard
1 changed files with 42 additions and 0 deletions
42
Userland/Applications/PixelPaint/Guide.h
Normal file
42
Userland/Applications/PixelPaint/Guide.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobi@tobyase.de>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
||||
class Guide : public RefCounted<Guide> {
|
||||
public:
|
||||
enum class Orientation {
|
||||
Vertical,
|
||||
Horizontal,
|
||||
};
|
||||
|
||||
Guide(Orientation orientation, float offset)
|
||||
: m_orientation(orientation)
|
||||
, m_offset(offset)
|
||||
{
|
||||
}
|
||||
|
||||
static NonnullRefPtr<Guide> construct(Orientation orientation, float offset)
|
||||
{
|
||||
return create<Guide>(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 };
|
||||
};
|
||||
|
||||
};
|
Loading…
Reference in a new issue