Skip to main content

GeometryBuilder

Struct GeometryBuilder 

Source
pub struct GeometryBuilder;
Expand description

Contains internal helpers used to build and draw various geometries.

Implementations§

Source§

impl GeometryBuilder

Source

pub fn draw_rounded_corners_rectangle_keypoints( context: &mut StreamGeometryContext, keypoints: &RoundedRectKeypoints, )

Draws a new rounded rectangle within the given geometry context. Warning: The caller must manage and dispose the StreamGeometryContext externally.

WinUI: https://github.com/microsoft/microsoft-ui-xaml/blob/93742a178db8f625ba9299f62c21f656e0b195ad/dxaml/xcp/core/core/elements/geometry.cpp#L1072-L1079

  • context - The geometry context to draw into.
  • keypoints - The rounded rectangle keypoints defining the rectangle to draw.
Source

pub fn draw_rounded_corners_rectangle( context: &mut dyn IGeometryContext, rect: Rect, radius_x: f64, radius_y: f64, )

Draws a new rounded rectangle within the given geometry context. Warning: The caller must manage and dispose the StreamGeometryContext externally.

  • context - The geometry context to draw into.
  • rect - The existing rectangle dimensions without corner radii.
  • radius_x - The radius on the X-axis used to round the corners of the rectangle.
  • radius_y - The radius on the Y-axis used to round the corners of the rectangle.
Source

pub fn calculate_rounded_corners_rectangle_win_ui( outer_bounds: Rect, border_thickness: Thickness, corner_radius: CornerRadius, sizing: BackgroundSizing, ) -> RoundedRectKeypoints

Calculates the keypoints of a rounded rectangle based on the algorithm in WinUI. These keypoints may then be drawn or transformed into other types.

  • outer_bounds - The outer bounds of the rounded rectangle. This should be the overall bounds and size of the shape/control without any corner radii or border thickness adjustments.
  • border_thickness - The unadjusted border thickness of the rounded rectangle.
  • corner_radius - The unadjusted corner radii of the rounded rectangle. The corner radius is defined to be the middle of the border stroke (center of the border).
  • sizing - The sizing mode used to calculate the final rounded rectangle size.

Returns new rounded rectangle keypoints.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.