From e4922f1ceb07025abf159b0ec6a6e0e595840199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 12 Jan 2024 19:26:19 +0100 Subject: [PATCH] Fix SvgPath::get_bounds --- api.json | 1 + api/c/azul.h | 2 +- api/cpp/azul.hpp | 2 +- api/rust/src/lib.rs | 6 +++--- azul-dll/src/lib.rs | 2 +- azul-dll/src/python.rs | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/api.json b/api.json index e132c2e3..8a28c838 100644 --- a/api.json +++ b/api.json @@ -12124,6 +12124,7 @@ }, "get_bounds": { "doc": "Returns the axis-aligned bounding rect of this path", + "returns": {"type": "SvgRect"}, "fn_args": [ {"self": "refmut"} ], diff --git a/api/c/azul.h b/api/c/azul.h index c8e5d7a6..afad82f9 100644 --- a/api/c/azul.h +++ b/api/c/azul.h @@ -13131,7 +13131,7 @@ extern DLLIMPORT AzTessellatedSvgNode AzSvgCircle_tessellateFill(const AzSvgCirc extern DLLIMPORT AzTessellatedSvgNode AzSvgCircle_tessellateStroke(const AzSvgCircle* svgcircle, AzSvgStrokeStyle stroke_style); extern DLLIMPORT bool AzSvgPath_isClosed(const AzSvgPath* svgpath); extern DLLIMPORT void AzSvgPath_reverse(AzSvgPath* restrict svgpath); -extern DLLIMPORT void AzSvgPath_getBounds(AzSvgPath* restrict svgpath); +extern DLLIMPORT AzSvgRect AzSvgPath_getBounds(AzSvgPath* restrict svgpath); extern DLLIMPORT void AzSvgPath_joinWith(AzSvgPath* restrict svgpath, AzSvgPath path); extern DLLIMPORT AzSvgPath AzSvgPath_offset(AzSvgPath* restrict svgpath, float distance, AzSvgLineJoin join, AzSvgLineCap cap); extern DLLIMPORT AzSvgPath AzSvgPath_bevel(AzSvgPath* restrict svgpath, float distance); diff --git a/api/cpp/azul.hpp b/api/cpp/azul.hpp index 4187a350..9b8c2cae 100644 --- a/api/cpp/azul.hpp +++ b/api/cpp/azul.hpp @@ -10992,7 +10992,7 @@ namespace dll { TessellatedSvgNode SvgCircle_tessellateStroke(const SvgCircle* svgcircle, AzSvgStrokeStyle stroke_style); bool SvgPath_isClosed(const SvgPath* svgpath); void SvgPath_reverse(SvgPath* restrict svgpath); - void SvgPath_getBounds(SvgPath* restrict svgpath); + SvgRect SvgPath_getBounds(SvgPath* restrict svgpath); void SvgPath_joinWith(SvgPath* restrict svgpath, AzSvgPath path); SvgPath SvgPath_offset(SvgPath* restrict svgpath, float distance, AzSvgLineJoin join, AzSvgLineCap cap); SvgPath SvgPath_bevel(SvgPath* restrict svgpath, float distance); diff --git a/api/rust/src/lib.rs b/api/rust/src/lib.rs index 6c2e8628..138774e6 100644 --- a/api/rust/src/lib.rs +++ b/api/rust/src/lib.rs @@ -11104,7 +11104,7 @@ mod dll { pub(crate) fn AzSvgCircle_tessellateStroke(svgcircle: &AzSvgCircle, stroke_style: AzSvgStrokeStyle) -> AzTessellatedSvgNode { unsafe { transmute(azul::AzSvgCircle_tessellateStroke(transmute(svgcircle), transmute(stroke_style))) } } pub(crate) fn AzSvgPath_isClosed(svgpath: &AzSvgPath) -> bool { unsafe { transmute(azul::AzSvgPath_isClosed(transmute(svgpath))) } } pub(crate) fn AzSvgPath_reverse(svgpath: &mut AzSvgPath) { unsafe { transmute(azul::AzSvgPath_reverse(transmute(svgpath))) } } - pub(crate) fn AzSvgPath_getBounds(svgpath: &mut AzSvgPath) { unsafe { transmute(azul::AzSvgPath_getBounds(transmute(svgpath))) } } + pub(crate) fn AzSvgPath_getBounds(svgpath: &mut AzSvgPath) -> AzSvgRect { unsafe { transmute(azul::AzSvgPath_getBounds(transmute(svgpath))) } } pub(crate) fn AzSvgPath_joinWith(svgpath: &mut AzSvgPath, path: AzSvgPath) { unsafe { transmute(azul::AzSvgPath_joinWith(transmute(svgpath), transmute(path))) } } pub(crate) fn AzSvgPath_offset(svgpath: &mut AzSvgPath, distance: f32, join: AzSvgLineJoin, cap: AzSvgLineCap) -> AzSvgPath { unsafe { transmute(azul::AzSvgPath_offset(transmute(svgpath), transmute(distance), transmute(join), transmute(cap))) } } pub(crate) fn AzSvgPath_bevel(svgpath: &mut AzSvgPath, distance: f32) -> AzSvgPath { unsafe { transmute(azul::AzSvgPath_bevel(transmute(svgpath), transmute(distance))) } } @@ -11941,7 +11941,7 @@ mod dll { pub(crate) fn AzSvgCircle_tessellateStroke(_: &AzSvgCircle, _: AzSvgStrokeStyle) -> AzTessellatedSvgNode; pub(crate) fn AzSvgPath_isClosed(_: &AzSvgPath) -> bool; pub(crate) fn AzSvgPath_reverse(_: &mut AzSvgPath); - pub(crate) fn AzSvgPath_getBounds(_: &mut AzSvgPath); + pub(crate) fn AzSvgPath_getBounds(_: &mut AzSvgPath) -> AzSvgRect; pub(crate) fn AzSvgPath_joinWith(_: &mut AzSvgPath, _: AzSvgPath); pub(crate) fn AzSvgPath_offset(_: &mut AzSvgPath, _: f32, _: AzSvgLineJoin, _: AzSvgLineCap) -> AzSvgPath; pub(crate) fn AzSvgPath_bevel(_: &mut AzSvgPath, _: f32) -> AzSvgPath; @@ -17985,7 +17985,7 @@ pub mod svg { /// Reverses the order of points in the path so that the path runs in the opposite direction afterwards pub fn reverse(&mut self) { unsafe { crate::dll::AzSvgPath_reverse(self) } } /// Returns the axis-aligned bounding rect of this path - pub fn get_bounds(&mut self) { unsafe { crate::dll::AzSvgPath_getBounds(self) } } + pub fn get_bounds(&mut self) -> crate::svg::SvgRect { unsafe { crate::dll::AzSvgPath_getBounds(self) } } /// Adds a path to the end of the current path pub fn join_with<_1: Into>(&mut self, path: _1) { unsafe { crate::dll::AzSvgPath_joinWith(self, path.into()) } } /// Offset the path by a certain distance. Will create bezier curves around the edges when the path is closed diff --git a/azul-dll/src/lib.rs b/azul-dll/src/lib.rs index 2243a191..f960fe76 100644 --- a/azul-dll/src/lib.rs +++ b/azul-dll/src/lib.rs @@ -3543,7 +3543,7 @@ pub use AzSvgPathTT as AzSvgPath; /// Reverses the order of points in the path so that the path runs in the opposite direction afterwards #[no_mangle] pub extern "C" fn AzSvgPath_reverse(svgpath: &mut AzSvgPath) { svgpath.reverse() } /// Returns the axis-aligned bounding rect of this path -#[no_mangle] pub extern "C" fn AzSvgPath_getBounds(svgpath: &mut AzSvgPath) { svgpath.get_bounds() } +#[no_mangle] pub extern "C" fn AzSvgPath_getBounds(svgpath: &mut AzSvgPath) -> AzSvgRect { svgpath.get_bounds() } /// Adds a path to the end of the current path #[no_mangle] pub extern "C" fn AzSvgPath_joinWith(svgpath: &mut AzSvgPath, path: AzSvgPath) { svgpath.join_with(path); } /// Offset the path by a certain distance. Will create bezier curves around the edges when the path is closed diff --git a/azul-dll/src/python.rs b/azul-dll/src/python.rs index 7a5cf3ce..ab6349b4 100644 --- a/azul-dll/src/python.rs +++ b/azul-dll/src/python.rs @@ -31450,7 +31450,7 @@ impl AzSvgPath { mem::transmute(self), )) } } - fn get_bounds(&mut self) -> () { + fn get_bounds(&mut self) -> AzSvgRect { unsafe { mem::transmute(crate::AzSvgPath_getBounds( mem::transmute(self), )) }