pub struct Region { /* private fields */ }
Expand description
A union of rectangles, useful for describing an area that needs to be repainted.
Implementations§
source§impl Region
impl Region
sourcepub fn bounding_box(&self) -> Rect
pub fn bounding_box(&self) -> Rect
Returns a rectangle containing this region.
sourcepub fn intersects(&self, rect: Rect) -> bool
pub fn intersects(&self, rect: Rect) -> bool
Returns true
if this region has a non-empty intersection with the given rectangle.
sourcepub fn contains(&self, point: Point) -> bool
pub fn contains(&self, point: Point) -> bool
Returns true
if the given point
is contained within any rectangle in the region.
sourcepub fn to_bez_path(&self) -> BezPath
pub fn to_bez_path(&self) -> BezPath
Converts into a Bezier path. Note that this just gives the concatenation of the rectangle paths, which is not the smartest possible thing. Also, it’s not the right answer for an even/odd fill rule.
sourcepub fn union_with(&mut self, other: &Region)
pub fn union_with(&mut self, other: &Region)
Modifies this region by including everything in the other region.
sourcepub fn intersect_with(&mut self, rect: Rect)
pub fn intersect_with(&mut self, rect: Rect)
Modifies this region by intersecting it with the given rectangle.
Trait Implementations§
source§impl AddAssign<Vec2> for Region
impl AddAssign<Vec2> for Region
source§fn add_assign(&mut self, rhs: Vec2)
fn add_assign(&mut self, rhs: Vec2)
Performs the
+=
operation. Read moreAuto Trait Implementations§
impl RefUnwindSafe for Region
impl Send for Region
impl Sync for Region
impl Unpin for Region
impl UnwindSafe for Region
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.