aboutsummaryrefslogtreecommitdiff
path: root/src/ui/d2d_util.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-12-12 00:40:57 +0800
committercrupest <crupest@outlook.com>2018-12-12 00:40:57 +0800
commitedbdf3d2a166099f5af4dd859258468288919685 (patch)
tree68c920a32156e13af8bde9d4db3f0a8478b1e499 /src/ui/d2d_util.hpp
parent3540c1718c74e9fa3538ae92a6418eb02d27f1c5 (diff)
downloadcru-edbdf3d2a166099f5af4dd859258468288919685.tar.gz
cru-edbdf3d2a166099f5af4dd859258468288919685.tar.bz2
cru-edbdf3d2a166099f5af4dd859258468288919685.zip
...
Diffstat (limited to 'src/ui/d2d_util.hpp')
-rw-r--r--src/ui/d2d_util.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ui/d2d_util.hpp b/src/ui/d2d_util.hpp
index d4fff620..5f2e10b2 100644
--- a/src/ui/d2d_util.hpp
+++ b/src/ui/d2d_util.hpp
@@ -19,6 +19,16 @@ namespace cru::ui
return D2D1::RectF(rect.left, rect.top, rect.left + rect.width, rect.top + rect.height);
}
+ inline D2D1_ROUNDED_RECT Convert(const RoundedRect& rounded_rect)
+ {
+ return D2D1::RoundedRect(Convert(rounded_rect.rect), rounded_rect.radius_x, rounded_rect.radius_y);
+ }
+
+ inline D2D1_ELLIPSE Convert(const Ellipse& ellipse)
+ {
+ return D2D1::Ellipse(Convert(ellipse.center), ellipse.radius_x, ellipse.radius_y);
+ }
+
inline Point Convert(const D2D1_POINT_2F& point)
{
return Point(point.x, point.y);
@@ -29,6 +39,16 @@ namespace cru::ui
return Rect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
}
+ inline RoundedRect Convert(const D2D1_ROUNDED_RECT& rounded_rect)
+ {
+ return RoundedRect(Convert(rounded_rect.rect), rounded_rect.radiusX, rounded_rect.radiusY);
+ }
+
+ inline Ellipse Convert(const D2D1_ELLIPSE& ellipse)
+ {
+ return Ellipse(Convert(ellipse.point), ellipse.radiusX, ellipse.radiusY);
+ }
+
inline bool operator==(const D2D1_POINT_2F& left, const D2D1_POINT_2F& right)
{
return left.x == right.x && left.y == right.y;
@@ -61,4 +81,14 @@ namespace cru::ui
{
return !(left == right);
}
+
+ inline bool operator == (const D2D1_ELLIPSE& left, const D2D1_ELLIPSE& right)
+ {
+ return left.point == right.point && left.radiusX == right.radiusX && left.radiusY == right.radiusY;
+ }
+
+ inline bool operator!=(const D2D1_ELLIPSE& left, const D2D1_ELLIPSE& right)
+ {
+ return !(left == right);
+ }
}