MyScript Interactive Ink SDK  3.1.3
Rectangle.h
1 // Copyright @ MyScript. All rights reserved.
2 
3 #pragma once
4 
5 #include <iostream>
6 
7 namespace myscript {
8 namespace iink {
9 namespace graphics {
10 
14 struct Rectangle
15 {
16  float x = 0.f;
17  float y = 0.f;
18  float width = 0.f;
19  float height = 0.f;
24  Rectangle() = default;
25 
34  Rectangle(float x, float y, float width, float height) noexcept
35  : x(x)
36  , y(y)
37  , width(width)
38  , height(height)
39  {
40  }
41 
49  bool operator==(const Rectangle& other) const noexcept
50  {
51  return x == other.x && y == other.y && width == other.width && height == other.height;
52  }
53 
61  bool operator!=(const Rectangle& other) const noexcept
62  {
63  return x != other.x || y != other.y || width != other.width || height != other.height;
64  }
65 };
66 
75 inline
76 std::ostream& operator<<(std::ostream& os, const Rectangle& rect)
77 {
78  os << "Rectangle(x: " << rect.x << ", y: " << rect.y << ", width: " << rect.width << ", height: " << rect.height << ")";
79  return os;
80 }
81 
82 }
83 }
84 }
std::ostream & operator<<(std::ostream &os, const Color &c)
Definition: Color.h:134
Definition: Configuration.h:11
Definition: Rectangle.h:15
float x
Definition: Rectangle.h:16
Rectangle(float x, float y, float width, float height) noexcept
Definition: Rectangle.h:34
float y
Definition: Rectangle.h:17
float height
Definition: Rectangle.h:19
float width
Definition: Rectangle.h:18
bool operator!=(const Rectangle &other) const noexcept
Definition: Rectangle.h:61
bool operator==(const Rectangle &other) const noexcept
Definition: Rectangle.h:49