Enrollment 28.2.0
Loading...
Searching...
No Matches
ImageMask.h
Go to the documentation of this file.
1
9
10#pragma once
11
14
15#include <memory>
16
17namespace inno
18{
22 */
23 enum class ImageMaskType : uint8_t
24 {
28 OUTSIDE = 0,
32 INSIDE = 1,
33 };
34
38 */
39 enum class ImageBlurType : uint8_t
40 {
45
54 };
55
59 */
61 {
62 public:
69 */
72 , c(Colors::White)
73 {
74 }
75
82 */
83 ImageMaskConfiguration(ImageMaskType maskType, RGBA maskColor)
84 : m(maskType)
85 , c(std::move(maskColor))
86 {
87 }
88
92 */
93 [[nodiscard]] ImageMaskType GetMaskType() const
94 {
95 return m;
96 }
97
101 */
102 [[nodiscard]] RGBA GetMaskColor() const
103 {
104 return c;
105 }
106
107 virtual ~ImageMaskConfiguration() = default;
110 ImageMaskConfiguration& operator=(const ImageMaskConfiguration&) = default;
111 ImageMaskConfiguration& operator=(ImageMaskConfiguration&&) = default;
112
113 private:
115 RGBA c;
116 };
117
121 */
122 class ImageMasker
123 {
124 public:
131 virtual void MaskCircle(const Circle& mask, const class ImageMaskConfiguration& conf) = 0;
132
139 virtual void MaskPolygon(const Polygon& mask, const ImageMaskConfiguration& conf) = 0;
140
148 virtual void BlurCircle(const Circle& circle, ImageMaskType maskType, ImageBlurType blurType) = 0;
149
157 virtual void BlurPolygon(const Polygon& polygon, ImageMaskType maskType, ImageBlurType blurType) = 0;
158
165 virtual void AddToBlur(const Circle& circle, ImageMaskType maskType) = 0;
166
173 virtual void AddToBlur(const Polygon& polygon, ImageMaskType maskType) = 0;
174
180 virtual void ApplyBlur(ImageBlurType blurType) = 0;
181 ImageMasker() = default;
182 virtual ~ImageMasker() = default;
183 ImageMasker(const ImageMasker&) = default;
184 ImageMasker(ImageMasker&&) = default;
185 ImageMasker& operator=(const ImageMasker&) = default;
186 ImageMasker& operator=(ImageMasker&&) = default;
187 };
188
192 */
193 class ImageMask
194 {
195 public:
201 virtual void MaskWith(ImageMasker& masker) const = 0;
202
203 ImageMask() = default;
204 virtual ~ImageMask() = default;
205 ImageMask(const ImageMask&) = default;
206 ImageMask(ImageMask&&) = default;
207 ImageMask& operator=(const ImageMask&) = delete;
208 ImageMask& operator=(ImageMask&&) = delete;
209 };
210
215 */
216 class CircleImageMask : public ImageMask
217 {
218 public:
224 */
226 : cfg(std::move(config))
227 , c(std::move(circle))
228 {
229 }
230
237 */
239 : cfg(std::move(config))
240 , c(std::move(circle))
241 , b(blur)
242 {
243 }
244
249 */
250 void MaskWith(ImageMasker& masker) const override
251 {
252 masker.MaskCircle(c, cfg);
254 {
255 masker.BlurCircle(c, cfg.GetMaskType(), b);
256 }
257 }
258
259 CircleImageMask() = default;
260 ~CircleImageMask() override = default;
261 CircleImageMask(const CircleImageMask&) = default;
262 CircleImageMask(CircleImageMask&&) = default;
263 CircleImageMask& operator=(const CircleImageMask&) = delete;
264 CircleImageMask& operator=(CircleImageMask&&) = delete;
265
266 private:
268 Circle c;
270 };
271
276 */
277 class PolygonImageMask : public ImageMask
278 {
279 public:
290 */
292 : cfg(std::move(config))
293 , p(std::move(polygon))
294 {
295 }
307 */
309 : cfg(std::move(config))
310 , p(std::move(polygon))
311 , b(blur)
312 {
313 }
314
319 */
320 void MaskWith(ImageMasker& masker) const override
321 {
322 masker.MaskPolygon(p, cfg);
324 {
325 masker.BlurPolygon(p, cfg.GetMaskType(), b);
326 }
327 }
328
329 PolygonImageMask() = default;
330 ~PolygonImageMask() override = default;
331 PolygonImageMask(const PolygonImageMask&) = default;
333 PolygonImageMask& operator=(const PolygonImageMask&) = delete;
334 PolygonImageMask& operator=(PolygonImageMask&&) = delete;
335
336 private:
338 Polygon p;
340 };
341
342} // namespace inno
Represents an image mask in the shape of a circle.
Definition ImageMask.h:216
CircleImageMask(Circle circle, ImageMaskConfiguration config)
Constructs a CircleImageMask with a specified circle and configuration.
Definition ImageMask.h:224
CircleImageMask(Circle circle, ImageMaskConfiguration config, ImageBlurType blur)
Constructs a CircleImageMask with a specified circle and configuration and blurring.
Definition ImageMask.h:237
void MaskWith(ImageMasker &masker) const override
Applies the circular mask to an image using the provided ImageMasker.
Definition ImageMask.h:249
It holds circle dimensions.
Definition ImageAttribute.h:691
It holds color literals.
Definition ImageAttribute.h:978
Configuration parameters for image masking operations, including mask type, and color.
Definition ImageMask.h:60
RGBA GetMaskColor() const
Retrieves the mask color.
Definition ImageMask.h:101
ImageMaskType GetMaskType() const
Retrieves the mask type.
Definition ImageMask.h:92
ImageMaskConfiguration(ImageMaskType maskType, RGBA maskColor)
Constructs a configuration with detailed mask settings including mask type and color.
Definition ImageMask.h:82
ImageMaskConfiguration()
Constructs a default image mask configuration.
Definition ImageMask.h:69
virtual void MaskWith(ImageMasker &masker) const =0
Applies a mask to the image using the provided ImageMasker.
Interface for image masking operations.
Definition ImageMask.h:122
virtual void BlurPolygon(const Polygon &polygon, ImageMaskType maskType, ImageBlurType blurType)=0
Applies a blur effect to a specified polygonal area in the image.
virtual void AddToBlur(const Polygon &polygon, ImageMaskType maskType)=0
Adds a polygonal area for a future blur operation.
virtual void ApplyBlur(ImageBlurType blurType)=0
Executes the blur effect on all added shapes with the specified blur type.
virtual void MaskCircle(const Circle &mask, const class ImageMaskConfiguration &conf)=0
Applies a circular image mask to an image.
virtual void BlurCircle(const Circle &circle, ImageMaskType maskType, ImageBlurType blurType)=0
Applies a blur effect to a specified circular area in the image.
virtual void MaskPolygon(const Polygon &mask, const ImageMaskConfiguration &conf)=0
Applies a specified polygonal mask to the image.
virtual void AddToBlur(const Circle &circle, ImageMaskType maskType)=0
Adds a circular area for a future blur operation.
Represents an image mask defined by a polygonal shape.
Definition ImageMask.h:277
PolygonImageMask(Polygon polygon, ImageMaskConfiguration config)
Constructs a PolygonImageMask with a specified polygon and configuration.
Definition ImageMask.h:290
void MaskWith(ImageMasker &masker) const override
Applies the polygonal mask to an image using the provided ImageMasker.
Definition ImageMask.h:319
PolygonImageMask(Polygon polygon, ImageMaskConfiguration config, ImageBlurType blur)
Constructs a PolygonImageMask with a specified polygon and configuration.
Definition ImageMask.h:307
It holds polygon points.
Definition ImageAttribute.h:765
It holds RGB color with transparency.
Definition ImageAttribute.h:908
ImageBlurType
Defines the type of border blurring applied to an image.
Definition ImageMask.h:39
ImageMaskType
Defines the polygon mask application area in image processing.
Definition ImageMask.h:23
@ NO_BORDER_BLURRING
No border blurring is applied.
Definition ImageMask.h:43
@ ISO_19794_BORDER_BLURRING
Applies border blurring according to ISO/IEC 19794-6 standard.
Definition ImageMask.h:52
@ INSIDE
Mask is applied to the region inside the shape, preserving the area outside.
Definition ImageMask.h:31
@ OUTSIDE
Mask is applied to the region outside the shape, preserving the area inside.
Definition ImageMask.h:27