pub struct ShapeClip {
pub geometry: ClipGeometry,
pub transform: Transform,
pub rule: FillRule,
}Expand description
A snapshotted Shape used for geometric intersection, not coverage multiplication.
Fields§
§geometry: ClipGeometrySnapshot of the local clipping geometry, not a bounding-box substitute.
transform: TransformLocal mapping in authoring, device mapping in a DisplayList.
rule: FillRuleInterior interpretation of this shape independently of its ancestors.
Implementations§
Source§impl ShapeClip
impl ShapeClip
Sourcepub fn new(shape: &(impl Shape + ?Sized)) -> Self
pub fn new(shape: &(impl Shape + ?Sized)) -> Self
Captures a shape once; trait objects are accepted without retaining them.
Exact rectangles retain raw bounds so invalid rectangles fail validation rather than panicking in Shape::path. Other shapes share a checked path.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let path = Path2D::from_rect(Rect::new(0.0, 0.0, 1.0, 1.0))?;
let shape: &dyn Shape = &path;
let mut clip = ShapeClip::new(shape);
clip.rule = FillRule::EvenOdd;
clip.transform = Transform::translate(0.5, 0.0);
let frame = Node::from(Rect::new(0.0, 0.0, 2.0, 1.0).fill(Color::WHITE))
.clip_with(clip, motion_core::ClipMode::Geometric)
.compile(
Size::new(2.0, 1.0),
PixelSize::new(2, 1),
ValidationLimits::default(),
)?;Trait Implementations§
impl StructuralPartialEq for ShapeClip
Auto Trait Implementations§
impl Forget for ShapeClip
impl Freeze for ShapeClip
impl RefUnwindSafe for ShapeClip
impl Send for ShapeClip
impl Sync for ShapeClip
impl Unpin for ShapeClip
impl UnsafeUnpin for ShapeClip
impl UnwindSafe for ShapeClip
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more