neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
pen.hpp
Go to the documentation of this file.
1// pen.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23#include <neogfx/gfx/color.hpp>
25
26namespace neogfx
27{
28 class pen
29 {
30 public:
31 // construction
32 public:
33 pen() : iWidth{ 0.0 } {}
34 pen(const color& aColor, bool aAntiAliased = true) : iColor{ aColor }, iWidth{ 1.0 }, iAntiAliased{ aAntiAliased } {}
35 pen(const color& aColor, dimension aWidth, bool aAntiAliased = true) : iColor{ aColor }, iWidth{ aWidth }, iAntiAliased{ aAntiAliased } {}
36 pen(const gradient& aColor, bool aAntiAliased = true) : iColor{ aColor }, iWidth{ 1.0 }, iAntiAliased{ aAntiAliased } {}
37 pen(const gradient& aColor, dimension aWidth, bool aAntiAliased = true) : iColor{ aColor }, iWidth{ aWidth }, iAntiAliased{ aAntiAliased } {}
38 pen(const color_or_gradient& aColor, bool aAntiAliased = true) : iColor{ aColor }, iWidth{ 1.0 }, iAntiAliased{ aAntiAliased } {}
39 pen(const color_or_gradient& aColor, dimension aWidth, bool aAntiAliased = true) : iColor{ aColor }, iWidth{ aWidth }, iAntiAliased{ aAntiAliased } {}
40 // operations
41 public:
42 const color_or_gradient& color() const { return iColor; }
43 dimension width() const { return iWidth; }
44 bool anti_aliased() const { return iAntiAliased; }
45 private:
46 color_or_gradient iColor;
47 dimension iWidth;
48 bool iAntiAliased;
49 };
50
51 typedef std::optional<pen> optional_pen;
52}
bool anti_aliased() const
Definition pen.hpp:44
pen(const color &aColor, dimension aWidth, bool aAntiAliased=true)
Definition pen.hpp:35
const color_or_gradient & color() const
Definition pen.hpp:42
pen(const gradient &aColor, dimension aWidth, bool aAntiAliased=true)
Definition pen.hpp:37
pen(const color_or_gradient &aColor, bool aAntiAliased=true)
Definition pen.hpp:38
dimension width() const
Definition pen.hpp:43
pen(const color &aColor, bool aAntiAliased=true)
Definition pen.hpp:34
pen(const gradient &aColor, bool aAntiAliased=true)
Definition pen.hpp:36
pen(const color_or_gradient &aColor, dimension aWidth, bool aAntiAliased=true)
Definition pen.hpp:39
default_geometry_value_type dimension
std::optional< pen > optional_pen
Definition pen.hpp:51