summaryrefslogtreecommitdiff
path: root/src/helpers/Region.hpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-06-19 16:20:06 +0200
committerVaxry <vaxry@vaxry.net>2024-06-19 16:20:15 +0200
commitfb15b7aa2a9bba0f0693f84d0c65d386942583f8 (patch)
treed4403944b5d6a3e03d2262f03a7d0b3ed6ffae24 /src/helpers/Region.hpp
parent6e5804b53de753f24953d9d647940df66bc68f6d (diff)
core: Move to hyprutils for Math
Moves CRegion, CBox and Vector2D over to hyprutils. Requires hyprutils>=0.1.4
Diffstat (limited to 'src/helpers/Region.hpp')
-rw-r--r--src/helpers/Region.hpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/helpers/Region.hpp b/src/helpers/Region.hpp
deleted file mode 100644
index 42693c21..00000000
--- a/src/helpers/Region.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-#include <pixman.h>
-#include <vector>
-#include "Vector2D.hpp"
-#include "Box.hpp"
-
-struct wlr_box;
-
-class CRegion {
- public:
- /* Create an empty region */
- CRegion();
- /* Create from a reference. Copies, does not own. */
- CRegion(const pixman_region32_t* const ref);
- /* Create from a box */
- CRegion(double x, double y, double w, double h);
- /* Create from a wlr_box */
- CRegion(wlr_box* box);
- /* Create from a CBox */
- CRegion(const CBox& box);
- /* Create from a pixman_box32_t */
- CRegion(pixman_box32_t* box);
-
- CRegion(const CRegion&);
- CRegion(CRegion&&);
-
- ~CRegion();
-
- CRegion& operator=(CRegion&& other) {
- pixman_region32_copy(&m_rRegion, other.pixman());
- return *this;
- }
-
- CRegion& operator=(CRegion& other) {
- pixman_region32_copy(&m_rRegion, other.pixman());
- return *this;
- }
-
- CRegion& clear();
- CRegion& set(const CRegion& other);
- CRegion& add(const CRegion& other);
- CRegion& add(double x, double y, double w, double h);
- CRegion& add(const CBox& other);
- CRegion& subtract(const CRegion& other);
- CRegion& intersect(const CRegion& other);
- CRegion& intersect(double x, double y, double w, double h);
- CRegion& translate(const Vector2D& vec);
- CRegion& transform(const wl_output_transform t, double w, double h);
- CRegion& invert(pixman_box32_t* box);
- CRegion& invert(const CBox& box);
- CRegion& scale(float scale);
- CRegion& scale(const Vector2D& scale);
- CRegion& rationalize();
- CBox getExtents();
- bool containsPoint(const Vector2D& vec) const;
- bool empty() const;
- Vector2D closestPoint(const Vector2D& vec) const;
- CRegion copy() const;
-
- std::vector<pixman_box32_t> getRects() const;
-
- //
- pixman_region32_t* pixman() {
- return &m_rRegion;
- }
-
- private:
- pixman_region32_t m_rRegion;
-};