IDS peak ICV v1.1.0
Loading...
Searching...
No Matches
peak_icv_drawing_options.hpp
Go to the documentation of this file.
1
11#pragma once
12
14
15#include <peak_common_c/detail/peak_common_defines.h>
18#include <peak_icv_c/painting/peak_icv_color.h>
19#include <peak_icv_c/painting/peak_icv_painter.h>
20#include <peak_icv_c/types/peak_icv_simple_types.h>
21
22namespace peak
23{
24namespace icv
25{
26namespace detail
27{
28
37{
38public:
44 DrawingOptions() = default;
45
53 PEAK_COMMON_NO_DISCARD constexpr Color GetColor() const;
54
62 PEAK_COMMON_NO_DISCARD Opacity GetOpacity() const;
63
69 void SetColor(const Color& color);
70
76 void SetOpacity(const Opacity& opacity);
77
78 bool operator==(const DrawingOptions& other) const;
79
80private:
81 friend peak::common::detail::BackendAccessor<DrawingOptions>;
82
83 explicit operator peak_icv_drawing_options() const;
84
85 Color m_color{ ColorConstant::Red };
86 Opacity m_opacity{ 100 };
87 size_t m_reserved{};
88};
89
91{
92 return m_color;
93}
94
96{
97 return m_opacity;
98}
99
100inline void DrawingOptions::SetColor(const Color& color)
101{
102 m_color = color;
103}
104
105inline void DrawingOptions::SetOpacity(const Opacity& opacity)
106{
107 m_opacity = opacity;
108}
109
110inline DrawingOptions::operator peak_icv_drawing_options() const // NOLINT
111{
112 return { m_color.GetRaw(), m_opacity.GetValue(), m_reserved };
113}
114
115inline bool DrawingOptions::operator==(const DrawingOptions& other) const
116{
117 return m_color == other.m_color && m_opacity.GetValue() == other.m_opacity.GetValue();
118}
119
120} // namespace detail
121} /* namespace icv */
122} /* namespace peak */
Holds a color code composed of red, green, and blue components.
Holds an opacity value representing the transparency level of an object or pixel.
constexpr uint32_t GetValue() const
constexpr Color GetColor() const
Get the color for drawing.
DrawingOptions()=default
Default Drawing options are red with 100% opacity.
void SetColor(const Color &color)
Set the color for drawing.
void SetOpacity(const Opacity &opacity)
Set the opacity for drawing.
Opacity GetOpacity() const
Get the opacity for drawing.
bool operator==(const DrawingOptions &other) const
@ Red
Represents red with 8-bit intensity.