PoDoFo  1.0.0-dev
Rect.h
1 
7 #ifndef AUX_RECT_H
8 #define AUX_RECT_H
9 
10 #include "basedefs.h"
11 
12 namespace PoDoFo {
13 
14 class PdfArray;
15 class Matrix;
16 
19 class PODOFO_API Rect final
20 {
21 public:
22  double X;
23  double Y;
24  double Width;
25  double Height;
26 
27 public:
30  Rect();
31 
34  Rect(double x, double y, double width, double height);
35 
38  Rect(const Rect& rhs) = default;
39 
40 public:
44  static Rect FromCorners(double x1, double y1, double x2, double y2);
45 
49  static Rect FromArray(const PdfArray& arr);
50 
54  void ToArray(PdfArray& arr) const;
55 
59  std::string ToString() const;
60 
61  bool Contains(double x, double y) const;
62 
63  // REMOVE-ME: The name of this method is bad and it's also
67  void Intersect(const Rect& rect);
68 
69 public:
72  double GetLeft() const { return X; }
73 
76  double GetBottom() const { return Y; }
77 
80  double GetRight() const;
81 
84  double GetTop() const;
85 
86 public:
87  bool operator==(const Rect& rect) const;
88  bool operator!=(const Rect& rect) const;
89 
90 public:
91  Rect operator*(const Matrix& m) const;
92  Rect& operator=(const Rect& rhs) = default;
93 };
94 
95 };
96 
97 #endif // AUX_RECT_H
This class represents a PdfArray Use it for all arrays that are written to a PDF file.
Definition: PdfArray.h:81
A rectangle defined by position and size.
Definition: Rect.h:20
double GetLeft() const
Get the left coordinate of the rectangle.
Definition: Rect.h:72
Rect(const Rect &rhs)=default
Copy constructor.
double GetBottom() const
Get the bottom coordinate of the rectangle.
Definition: Rect.h:76
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
@ Width
The glyph is accessed in the widths arrays (/Widths, /W1 keys)