Skip to main content

local_bounds

Function local_bounds 

pub fn local_bounds(
    ctm: &Matrix,
    path: &Handle<SkPath>,
    z_plane_params: impl Into<Point3>,
    light_pos: impl Into<Point3>,
    light_radius: f32,
    flags: u32,
) -> Option<Rect>
Expand description

Generate bounding box for shadows relative to path. Includes both the ambient and spot shadow bounds.

  • ctm Current transformation matrix to device space.
  • path The occluder used to generate the shadows.
  • z_plane_params Values for the plane function which returns the Z offset of the occluder from the canvas based on local x and y values (the current matrix is not applied).
  • light_pos Generally, the 3D position of the light relative to the canvas plane. If self::ShadowFlags::DIRECTIONAL_LIGHT is set, this specifies a vector pointing towards the light.
  • light_radius Generally, the radius of the disc light. If self::ShadowFlags::DIRECTIONAL_LIGHT is set, this specifies the amount of blur when the occluder is at Z offset == 1. The blur will grow linearly as the Z value increases.
  • flags Options controlling opaque occluder optimizations, shadow appearance, and light position. See self::ShadowFlags.

Returns the shadow bounding box if successful, None otherwise.