Enrollment 28.2.0
Loading...
Searching...
No Matches
ImageAttribute.h
Go to the documentation of this file.
1
9
10#pragma once
11
14#include <array>
15#include <cmath>
16#include <cstdint>
17#include <memory>
18#include <vector>
19
20// cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes: This is not a
21// problem because we are using them only as read only.
22// cppcoreguidelines-avoid-const-or-ref-data-members: We design te API with const member variables instead of
23// implementing getter methods. This is nicely transformed in C# to properties. Usually our objects are immutable by
24// intention to have no problem in multithreaded applications.
25// NOLINTBEGIN(cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes,cppcoreguidelines-avoid-const-or-ref-data-members)
26namespace inno
27{
32 using ImageDimension = unsigned int;
46 */
47 class ImageDpi
48 {
49 public:
54 */
55 explicit constexpr ImageDpi(unsigned int i)
56 : dpi(i)
57 {
58 }
61 */
62 explicit operator unsigned int() const
63 {
64 return dpi;
65 }
70 */
71 [[nodiscard]] unsigned int ToDPCM() const
72 {
73 static constexpr float CmInInch = 2.54F;
74 return static_cast<unsigned int>(std::round(static_cast<float>(dpi) / CmInInch));
75 }
76
81 */
82 [[nodiscard]] static ImageDpi FromDPCM(unsigned int dpcm)
83 {
84 static constexpr float CmInInch = 2.54F;
85 return ImageDpi{ static_cast<unsigned int>(static_cast<float>(dpcm) * CmInInch) };
86 }
87
88 bool operator==(const ImageDpi& r) const
89 {
90 return dpi == r.dpi;
91 }
92
93 ImageDpi() = default;
94 ~ImageDpi() = default;
95 ImageDpi(const ImageDpi&) = default;
96 ImageDpi(ImageDpi&&) = default;
97 ImageDpi& operator=(const ImageDpi&) = default;
98 ImageDpi& operator=(ImageDpi&&) = default;
99
100 private:
101 static constexpr unsigned int DefaultDpi = 500;
102 unsigned int dpi = DefaultDpi;
103 };
108 constexpr ImageDpi DefaultDpi;
113 using X = int;
118 using Y = int;
123 using Angle = float;
128 using Radius = unsigned int;
129
134 */
135 class RawImage : public Serializable
136 {
137 public:
138 /// RawImage encoding type.
139 enum Type : uint8_t
140 {
147 GRAYSCALE,
154 BGR,
167 BGRA
168 };
169
171 const ImageDpi dpi;
173 const ImageWidth width;
175 const ImageHeight height;
177 const Type type;
179 const unsigned char channels;
180
185 */
186 [[nodiscard]] const std::vector<uint8_t>& Data() const
187 {
188 return data;
189 }
190
194 */
195 void WriteTo(Writer& writer) const final
196 {
197 writer.Write("t", type);
198 writer.Write("h", height);
199 writer.Write("w", width);
200 writer.Write("p", static_cast<unsigned int>(dpi));
201 writer.WriteArray("d", data);
202 }
203
213 */
214 RawImage(ImageWidth w, ImageHeight h, ImageDpi d, Type t, std::vector<uint8_t>&& r)
215 : dpi(d)
216 , width(w)
217 , height(h)
218 , type(t)
219 , channels(Channels(t))
220 , data(std::move(r))
221 {
222 }
231 */
232 RawImage(ImageWidth w, ImageHeight h, ImageDpi d, Type t, const std::vector<uint8_t>& r)
233 : dpi(d)
234 , width(w)
235 , height(h)
236 , type(t)
237 , channels(Channels(t))
238 , data(r)
239 {
240 }
241 RawImage() = delete;
242 RawImage(const RawImage& r) = default;
243 RawImage(RawImage&&) = default;
244 RawImage& operator=(const RawImage&) = delete;
245 RawImage& operator=(RawImage&&) = delete;
246 virtual ~RawImage() = default;
247
248 bool operator==(const RawImage& r) const
249 {
250 return dpi == r.dpi && width == r.width && height == r.height && type == r.type && channels == r.channels &&
251 data == r.data;
252 }
253 bool operator!=(const RawImage& r) const
254 {
255 return !(*this == r);
256 }
257
258 private:
259 std::vector<uint8_t> data;
260
261 static unsigned char Channels(Type t)
262 {
263 switch (t)
264 {
265 case BGR:
266 return 3;
267 case BGRA:
268 return 4;
269 case GRAYSCALE:
270 return 1;
271 }
272 return 0;
273 }
274 };
275
280 */
281 class ImageDimensions final
282 {
283 public:
288 */
290 : width(w)
291 , height(h)
292 {
293 }
294
296 ImageWidth width = 0;
299
300 ImageDimensions() = default;
301 ImageDimensions(const ImageDimensions& d) = default;
302 ImageDimensions(ImageDimensions&&) = default;
303 ImageDimensions& operator=(const ImageDimensions&) = default;
304 ImageDimensions& operator=(ImageDimensions&&) = default;
305 ~ImageDimensions() = default;
306 };
307
311 */
312 class Point final : public Serializable
313 {
314 public:
319 */
320 Point(X xCoordinate, Y yCoordinate)
321 : x(xCoordinate)
322 , y(yCoordinate)
323 {
324 }
325
327 X x = 0;
329 Y y = 0;
331 void WriteTo(Writer& writer) const final
332 {
333 writer.Write("x", x);
334 writer.Write("y", y);
335 }
336
337 Point(const Point& p) = default;
338 Point(Point&& p) = default;
339 Point() = default;
340 Point& operator=(const Point& r) = default;
341 Point& operator=(Point&& r) = default;
342
343 bool operator==(const Point& r) const
344 {
345 return r.x == x && r.y == y;
346 }
347
348 virtual ~Point() = default;
349 };
350
356 */
357 class Rectangle final : public Serializable
358 {
359 public:
364 using Dimension = float;
368 using Height = Dimension;
372 using Width = Dimension;
373
377 */
378 [[nodiscard]] const Point& GetTopLeft() const
379 {
380 return topLeft;
381 }
385 */
386 [[nodiscard]] const Point& GetTopRight() const
387 {
388 return topRight;
389 }
393 */
394 [[nodiscard]] const Point& GetBottomRight() const
395 {
396 return bottomRight;
397 }
401 */
402 [[nodiscard]] const Point& GetBottomLeft() const
403 {
404 return bottomLeft;
405 }
412 */
413 [[nodiscard]] Width GetWidth() const
414 {
415 return width;
416 }
423 */
424 [[nodiscard]] Height GetHeight() const
425 {
426 return height;
427 }
436 */
437 [[nodiscard]] Rectangle Resize(Width w, Height h) const
438 {
439 if (w < 1)
440 {
441 throw EnrollmentInvalidArgumentException("Width must be >= 1 to resize rectangle");
442 }
443 if (h < 1)
444 {
445 throw EnrollmentInvalidArgumentException("Height must be >= 1 to resize rectangle");
446 }
447
448 int newTopLeftX = 0;
449 int newTopLeftY = 0;
450 int newTopRightX = 0;
451 int newTopRightY = 0;
452 int newBottomRightX = 0;
453 int newBottomRightY = 0;
454 int newBottomLeftX = 0;
455 int newBottomLeftY = 0;
456 exec->ResizeRectangle(w,
457 h,
458 topLeft.x,
459 topLeft.y,
460 topRight.x,
461 topRight.y,
462 bottomRight.x,
463 bottomRight.y,
464 bottomLeft.x,
465 bottomLeft.y,
466 &newTopLeftX,
467 &newTopLeftY,
468 &newTopRightX,
469 &newTopRightY,
470 &newBottomRightX,
471 &newBottomRightY,
472 &newBottomLeftX,
473 &newBottomLeftY,
474 ThrowOnError{});
475
476 return { { newTopLeftX, newTopLeftY },
477 { newTopRightX, newTopRightY },
478 { newBottomRightX, newBottomRightY },
479 { newBottomLeftX, newBottomLeftY },
480 w,
481 h,
482 exec };
483 }
484
488 */
489 [[nodiscard]] Point CalculateCenter() const
490 {
491 const auto centerX =
492 static_cast<int>(static_cast<float>(topLeft.x + bottomRight.x + topRight.x + bottomLeft.x) / 4.0F);
493 const auto centerY =
494 static_cast<int>(static_cast<float>(topLeft.y + bottomRight.y + topRight.y + bottomLeft.y) / 4.0F);
495 return { centerX, centerY };
496 }
498 void WriteTo(Writer& writer) const final
499 {
500 writer.Write("tl", topLeft);
501 writer.Write("tr", topRight);
502 writer.Write("br", bottomRight);
503 writer.Write("bl", bottomLeft);
504 writer.Write("h", height);
505 writer.Write("w", width);
506 }
507
516 */
517 Rectangle(Point topLeftPoint, Point topRightPoint, Point bottomRightPoint, Point bottomLeftPoint)
518 : Rectangle(std::move(topLeftPoint),
519 std::move(topRightPoint),
520 std::move(bottomRightPoint),
521 std::move(bottomLeftPoint),
522 GlobalImageExecutor::Get())
523 {
524 }
525
535 */
536 Rectangle(Point topLeftPoint,
537 Point topRightPoint,
538 Point bottomRightPoint,
539 Point bottomLeftPoint,
540 std::shared_ptr<ImageExecutor> executor)
541 : topLeft(std::move(topLeftPoint))
542 , topRight(std::move(topRightPoint))
543 , bottomLeft(std::move(bottomLeftPoint))
544 , bottomRight(std::move(bottomRightPoint))
545 , exec(std::move(executor))
546 {
547 if (exec == nullptr)
548 {
549 throw NullArgumentException("executor can not be null");
550 }
551
552 exec->GetRectangleDimensions(&width,
553 &height,
554 topLeft.x,
555 topLeft.y,
556 topRight.x,
557 topRight.y,
558 bottomRight.x,
559 bottomRight.y,
560 bottomLeft.x,
561 bottomLeft.y,
562 ThrowOnError{});
563 }
564
565 Rectangle(const Rectangle&) = default;
566 Rectangle(Rectangle&& r) = default;
567 Rectangle& operator=(const Rectangle&) = default;
568 Rectangle& operator=(Rectangle&&) = default;
569
570 bool operator==(const Rectangle& r) const
571 {
572 return r.bottomLeft == bottomLeft && r.bottomRight == bottomRight && r.topLeft == topLeft &&
573 r.topRight == topRight;
574 }
575
576 bool operator!=(const Rectangle& r) const
577 {
578 return !(*this == r);
579 }
580
581 virtual ~Rectangle() = default;
582 Rectangle() = default;
583
584 private:
585 Rectangle(Point topLeftPoint,
586 Point topRightPoint,
587 Point bottomRightPoint,
588 Point bottomLeftPoint,
589 Width w,
590 Height h,
591 std::shared_ptr<ImageExecutor> executor)
592 : topLeft(std::move(topLeftPoint))
593 , topRight(std::move(topRightPoint))
594 , bottomLeft(std::move(bottomLeftPoint))
595 , bottomRight(std::move(bottomRightPoint))
596 , width(w)
597 , height(h)
598 , exec(std::move(executor))
599 {
600 }
601
602 Point topLeft;
603 Point topRight;
604 Point bottomLeft;
605 Point bottomRight;
606 Width width = 0.0F;
607 Height height = 0.0F;
608 std::shared_ptr<ImageExecutor> exec;
609 };
610
614 */
615 class Line final : public Serializable
616 {
617 public:
619 Point begin;
621 Point end;
623 void WriteTo(Writer& writer) const final
624 {
625 writer.Write("b", begin);
626 writer.Write("e", end);
627 }
628
633 */
634 Line(Point beginPoint, Point endPoint)
635 : begin(std::move(beginPoint))
636 , end(std::move(endPoint))
637 {
638 }
645 */
646 Line(Point b, float angle, unsigned int length)
647 : begin(std::move(b))
648 , end(CalculateEndPoint(begin, angle, length))
649 {
650 }
651 Line(const Line&) = default;
652 Line(Line&& r) = default;
653 Line& operator=(const Line&) = default;
654 Line& operator=(Line&&) = default;
655
656 bool operator==(const Line& r) const
657 {
658 return r.begin == begin && r.end == end;
659 }
660
661 bool operator!=(const Line& r) const
662 {
663 return !(*this == r);
664 }
665
666 virtual ~Line() = default;
667 Line() = default;
668
669 private:
670 static Point CalculateEndPoint(const Point& begin, float angle, unsigned int length)
671 {
672 // The clang-tidy suggest to use 'std::numbers::pi'. Due to compilation issues with our dependency
673 // Boost 1.73 in Android NDK r26d (first version that contains 'number' header), we're unable to utilize the
674 // suggested change. NOLINTNEXTLINE(modernize-use-std-numbers)
675 static constexpr float PiNum = 3.14159265358979323846F;
676 static constexpr float Degrees = 180.0F;
677 // Convert degrees to radians for std::cos and std::sin
678 auto angleRadians = angle * PiNum / Degrees;
679 auto ex = static_cast<X>(
680 std::round(static_cast<float>(begin.x) + static_cast<float>(length) * std::cos(angleRadians)));
681 auto ey = static_cast<Y>(
682 std::round(static_cast<float>(begin.y) - static_cast<float>(length) * std::sin(angleRadians)));
683 return Point{ ex, ey };
684 }
685 };
686
690 */
691 class Circle final : public Serializable
692 {
693 public:
697 Radius radius = 0;
698
703 */
704 [[nodiscard]] static Circle CreateInscribedCircle(const Rectangle& rect)
705 {
706 const auto width = rect.GetWidth();
707 const auto height = rect.GetHeight();
708 const float diameter = std::min(width, height);
709 constexpr auto RadiusDiameterQuotient = 2.0F;
710 const auto radius = static_cast<unsigned int>(diameter / RadiusDiameterQuotient);
711 const auto center = rect.CalculateCenter();
712 return { center, radius };
713 }
715 void WriteTo(Writer& writer) const final
716 {
717 writer.Write("c", center);
718 writer.Write("r", radius);
719 }
720
725 */
726 [[nodiscard]] Rectangle BoundingRectangle() const
727 {
728 return Rectangle{ { center.x - static_cast<int>(radius), center.y - static_cast<int>(radius) },
729 { center.x + static_cast<int>(radius), center.y - static_cast<int>(radius) },
730 { center.x + static_cast<int>(radius), center.y + static_cast<int>(radius) },
731 { center.x - static_cast<int>(radius), center.y + static_cast<int>(radius) } };
732 }
737 */
738 Circle(Point centerPoint, Radius circleRadius)
739 : center(std::move(centerPoint))
740 , radius(circleRadius)
741 {
742 }
743 Circle(const Circle& c) = default;
744 Circle(Circle&& c) = default;
745 Circle& operator=(const Circle& r) = default;
746 Circle& operator=(Circle&& c) = default;
747 virtual ~Circle() = default;
748 Circle() = default;
749
750 bool operator==(const Circle& c) const
751 {
752 return c.center == center && c.radius == radius;
753 }
754
755 bool operator!=(const Circle& c) const
756 {
757 return !(*this == c);
758 }
759 };
760
764 */
765 class Polygon final : public Serializable
766 {
767 public:
768 void WriteTo(Writer& writer) const final
769 {
770 writer.WriteArray("p", p);
771 }
772
777 */
778 void AddPoint(const Point& point)
779 {
780 p.push_back(point);
781 }
782
786 */
787 void AddPoint(Point&& point)
788 {
789 p.push_back(std::move(point));
790 }
791
796 */
797 [[nodiscard]] const std::vector<Point>& GetPoints() const
798 {
799 return p;
800 }
801
806 */
807 explicit Polygon(std::vector<Point>&& points)
808 : p(std::move(points)) {};
809
814 */
815 explicit Polygon(const std::vector<Point>& points)
816 : p(points) {};
817
818 Polygon(const Polygon&) = default;
819 Polygon(Polygon&& other) = default;
820 Polygon& operator=(Polygon&& other) = default;
821 Polygon& operator=(const Polygon&) = default;
822 virtual ~Polygon() = default;
823 Polygon() = default;
824
825 bool operator==(const Polygon& other) const
826 {
827 auto otherIt = other.GetPoints().cbegin();
828 for (const auto& thisPoint : p)
829 {
830 if (thisPoint != *otherIt)
831 {
832 return false;
833 }
834 otherIt++;
835 }
836 return true;
837 }
838
839 bool operator!=(const Polygon& other) const
840 {
841 return !(*this == other);
842 }
843
844 private:
845 std::vector<Point> p;
846 };
847
848#ifdef _WIN32
849#undef RGB
850#endif
851
861 */
862 class RGB final : public Serializable
863 {
864 public:
866 unsigned char red = 0;
868 unsigned char green = 0;
870 unsigned char blue = 0;
872 void WriteTo(Writer& writer) const final
873 {
874 writer.Write("r", red);
875 writer.Write("g", green);
876 writer.Write("b", blue);
877 }
878
879 RGB(unsigned char r, unsigned char g, unsigned char b)
880 : red(r)
881 , green(g)
882 , blue(b)
883 {
884 }
885 RGB(const RGB&) = default;
886 RGB(RGB&&) = default;
887 RGB& operator=(const RGB&) = default;
888 RGB& operator=(RGB&& c) = default;
889 RGB() = default;
890
891 bool operator==(const RGB& c) const
892 {
893 return c.red == red && c.green == green && c.blue == blue;
894 }
895
896 bool operator!=(const RGB& c) const
897 {
898 return !(*this == c);
899 }
900
901 virtual ~RGB() = default;
902 };
903
907 */
908 class RGBA final : public Serializable
909 {
910 public:
912 RGB color;
914 unsigned char transparency = FULLY_OPAQUE;
915
916 enum : uint8_t
917 {
921 FULLY_OPAQUE = 255
922 };
924 void WriteTo(Writer& writer) const final
925 {
926 writer.Write("c", color);
927 writer.Write("t", transparency);
928 }
929
930 RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char t) noexcept
931 : color(r, g, b)
932 , transparency(t)
933 {
934 }
935 RGBA(RGB rgb, unsigned char t) noexcept
936 : color(std::move(rgb))
937 , transparency(t)
938 {
939 }
940
941 explicit RGBA(RGB rgb) noexcept
942 : color(std::move(rgb))
943 {
944 }
945 RGBA(const RGBA& c) = default;
946 RGBA(RGBA&& c) = default;
947 RGBA& operator=(const RGBA& c) = default;
948 RGBA& operator=(RGBA&& c) = default;
949 RGBA() = default;
950
951 bool operator==(const RGBA& c) const
952 {
953 return c.color == color && c.transparency == transparency;
954 }
955
956 bool operator!=(const RGBA& c) const
957 {
958 return !(*this == c);
959 }
960
961 virtual ~RGBA() = default;
962 };
963
964#if defined SWIGPYTHON || defined SWIGRUBY
965 // The Colors class will be ignored for python and ruby binding.
966 // Swig is not able to generate binding correctly for inline static const members
967 // for python and ruby.
968 static const RGBA ColorsInnoBlue = RGBA(133, 183, 226, RGBA::FULLY_OPAQUE);
969 static const RGBA ColorsWhite = RGBA(255, 255, 255, RGBA::FULLY_OPAQUE);
970 static const RGBA ColorsLightGray = RGBA(211, 211, 211, RGBA::FULLY_OPAQUE);
971
972#endif
973
977 */
978 class Colors final
979 {
980 public:
981 // NOLINTNEXTLINE(fuchsia-statically-constructed-objects)
982 inline static const RGBA InnoBlue = RGBA(133, 183, 226, RGBA::FULLY_OPAQUE);
983 // NOLINTNEXTLINE(fuchsia-statically-constructed-objects)
984 inline static const RGBA White = RGBA(255, 255, 255, RGBA::FULLY_OPAQUE);
985 // NOLINTNEXTLINE(fuchsia-statically-constructed-objects)
986 inline static const RGBA LightGray = RGBA(211, 211, 211, RGBA::FULLY_OPAQUE);
987
988 Colors(const Colors&) = delete;
989 Colors(Colors&&) = delete;
990 Colors& operator=(const Colors&) = delete;
991 Colors& operator=(Colors&&) = delete;
992 Colors() = delete;
993 ~Colors() = delete;
994 };
995} // namespace inno
996// NOLINTEND(cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes,cppcoreguidelines-avoid-const-or-ref-data-members)
constexpr ImageDpi DefaultDpi
Provides default DPI Default DPI is 500.
Definition ImageAttribute.h:107
It holds circle dimensions.
Definition ImageAttribute.h:691
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:714
Point center
top left
Definition ImageAttribute.h:694
Rectangle BoundingRectangle() const
It provides bounding rectangle for circle.
Definition ImageAttribute.h:725
static Circle CreateInscribedCircle(const Rectangle &rect)
Creates the largest circle that fits entirely within a given rectangle.
Definition ImageAttribute.h:703
Circle(Point centerPoint, Radius circleRadius)
Constructor store given coordinates.
Definition ImageAttribute.h:737
Radius radius
top right
Definition ImageAttribute.h:696
Base exception for all enrollment-sdk invalid argument exceptions.
Definition EnrollmentException.h:96
Holds instance of ImageExecutor.
Definition ImageExecutor.h:1564
ImageDimensions(ImageWidth w, ImageHeight h)
Constructor store given dimensions.
Definition ImageAttribute.h:288
ImageWidth width
width
Definition ImageAttribute.h:295
ImageHeight height
height
Definition ImageAttribute.h:297
Image DPI.
Definition ImageAttribute.h:47
static ImageDpi FromDPCM(unsigned int dpcm)
Converts dot per centimeter to dot per inch.
Definition ImageAttribute.h:81
unsigned int ToDPCM() const
Converts DPI to dot per centimeter.
Definition ImageAttribute.h:70
constexpr ImageDpi(unsigned int i)
Construct a new DPI.
Definition ImageAttribute.h:54
It holds line points.
Definition ImageAttribute.h:615
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:622
Line(Point b, float angle, unsigned int length)
Constructor calculates end point based on angle and length.
Definition ImageAttribute.h:645
Point end
line end point
Definition ImageAttribute.h:620
Point begin
line begin point
Definition ImageAttribute.h:618
Line(Point beginPoint, Point endPoint)
Constructor store given coordinates.
Definition ImageAttribute.h:633
Null argument is not allowed.
Definition EnrollmentException.h:156
It holds X and Y coordinates of point.
Definition ImageAttribute.h:312
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:330
X x
X Coordinate.
Definition ImageAttribute.h:326
Point(X xCoordinate, Y yCoordinate)
Constructor store given dimensions.
Definition ImageAttribute.h:319
Y y
Y Coordinate.
Definition ImageAttribute.h:328
It holds polygon points.
Definition ImageAttribute.h:765
void AddPoint(const Point &point)
Adds a point to the polygon.
Definition ImageAttribute.h:777
Polygon(const std::vector< Point > &points)
Constructs a polygon with a given set of points.
Definition ImageAttribute.h:814
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:767
const std::vector< Point > & GetPoints() const
Retrieves the points describing the polygon.
Definition ImageAttribute.h:796
Polygon(std::vector< Point > &&points)
Constructs a polygon with a given set of points using move semantics.
Definition ImageAttribute.h:806
void AddPoint(Point &&point)
Adds a point to the polygon using move semantics.
Definition ImageAttribute.h:786
It holds RGB color with transparency.
Definition ImageAttribute.h:908
RGB color
color definition in RGB model
Definition ImageAttribute.h:911
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:923
@ FULLY_TRANSPARENT
Color is fully transparent, means it is not visible.
Definition ImageAttribute.h:918
@ FULLY_OPAQUE
Color is fully opaque, means it is visible.
Definition ImageAttribute.h:920
unsigned char transparency
Transparency where 0 is fully transparent and 255 is fully opaque.
Definition ImageAttribute.h:913
It holds RGB colors.
Definition ImageAttribute.h:862
unsigned char red
Red value of RGB color model. The value is in range <0,255>.
Definition ImageAttribute.h:865
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:871
unsigned char green
Green value of RGB color model. The value is in range <0,255>.
Definition ImageAttribute.h:867
unsigned char blue
Blue value of RGB color model. The value is in range <0,255>.
Definition ImageAttribute.h:869
Contains plain image data.
Definition ImageAttribute.h:135
RawImage(ImageWidth w, ImageHeight h, ImageDpi d, Type t, const std::vector< uint8_t > &r)
Construct a new Raw Image object Data vector is stored as a copy.
Definition ImageAttribute.h:231
const ImageHeight height
Image height in pixels.
Definition ImageAttribute.h:174
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:194
const ImageDpi dpi
Image DPI.
Definition ImageAttribute.h:170
const ImageWidth width
Image width in pixels.
Definition ImageAttribute.h:172
const unsigned char channels
Number of RawImage channels.
Definition ImageAttribute.h:178
RawImage(ImageWidth w, ImageHeight h, ImageDpi d, Type t, std::vector< uint8_t > &&r)
Construct a new Raw Image object Data vector is passed by rvalue reference for efficient transfer wit...
Definition ImageAttribute.h:213
Type
RawImage encoding type.
Definition ImageAttribute.h:139
@ GRAYSCALE
Raw data where image pixels are stored in grayscale format.
Definition ImageAttribute.h:146
@ BGR
Raw data where image pixels are stored in BGR format.
Definition ImageAttribute.h:153
@ BGRA
Raw data where image pixels are stored in BGR with alpha format.
Definition ImageAttribute.h:166
const std::vector< uint8_t > & Data() const
Definition ImageAttribute.h:185
const Type type
RawImage type.
Definition ImageAttribute.h:176
It holds rectangle vertexes, width, height.
Definition ImageAttribute.h:357
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageAttribute.h:497
Dimension Height
Rectangle height.
Definition ImageAttribute.h:367
Rectangle(Point topLeftPoint, Point topRightPoint, Point bottomRightPoint, Point bottomLeftPoint)
Constructor store given coordinates.
Definition ImageAttribute.h:516
float Dimension
The rectangle dimension.
Definition ImageAttribute.h:363
Rectangle Resize(Width w, Height h) const
Resize rectangle to given width and height.
Definition ImageAttribute.h:436
const Point & GetBottomLeft() const
Provides bottom-left vertex.
Definition ImageAttribute.h:401
Dimension Width
Rectangle width.
Definition ImageAttribute.h:371
const Point & GetTopLeft() const
Provides top-left vertex.
Definition ImageAttribute.h:377
const Point & GetBottomRight() const
Provides bottom-right vertex.
Definition ImageAttribute.h:393
Point CalculateCenter() const
Calculates the center point of the rectangle.
Definition ImageAttribute.h:488
Rectangle(Point topLeftPoint, Point topRightPoint, Point bottomRightPoint, Point bottomLeftPoint, std::shared_ptr< ImageExecutor > executor)
Constructor store given coordinates.
Definition ImageAttribute.h:535
Width GetWidth() const
Provides width of rectangle The width is distance between top-left and top-right vertexes.
Definition ImageAttribute.h:412
const Point & GetTopRight() const
Provides top-right vertex.
Definition ImageAttribute.h:385
Height GetHeight() const
Provides height of rectangle The height is distance between bottom-left and top-left vertexes.
Definition ImageAttribute.h:423
Provides interface for serialization of all classes.
Definition Writer.h:164
float Angle
Angle in degrees.
Definition ImageAttribute.h:122
unsigned int Radius
Radius.
Definition ImageAttribute.h:127
int Y
Y coordinate.
Definition ImageAttribute.h:117
ImageDimension ImageHeight
Image Height.
Definition ImageAttribute.h:36
unsigned int ImageDimension
Image dimension.
Definition ImageAttribute.h:31
ImageDimension ImageWidth
Image Width.
Definition ImageAttribute.h:41
int X
X coordinate.
Definition ImageAttribute.h:112