Struct rasterize::BBox

source ·
pub struct BBox { /* private fields */ }
Expand description

Bounding box with sides directed along the axes

Implementations§

source§

impl BBox

source

pub fn new(p0: impl Into<Point>, p1: impl Into<Point>) -> Self

Construct bounding box which includes points p0 and p1

source

pub fn min(&self) -> Point

Point with minimum values of x and y coordinates

source

pub fn max(&self) -> Point

Point with minimum values of x and y coordinates

source

pub fn x(&self) -> Scalar

x coordinate of the point with the minimal value

source

pub fn y(&self) -> Scalar

y coordinate of the point with the minimal value

source

pub fn width(&self) -> Scalar

Width of the bounding box

source

pub fn height(&self) -> Scalar

Hight of the bounding box

source

pub fn diag(&self) -> Line

Diagonal line from min to max of the bounding box

source

pub fn contains(&self, point: Point) -> bool

Determine if the point is inside of the bounding box

source

pub fn extend(&self, point: Point) -> Self

Extend bounding box so it would contains provided point

source

pub fn union(&self, other: BBox) -> Self

Create union bounding box of two bounding boxes

source

pub fn union_opt(&self, other: Option<BBox>) -> Self

source

pub fn intersect(&self, other: BBox) -> Option<BBox>

Find bounding box of the intersection of two bounding boxes

source

pub fn unit_transform(&self) -> Transform

Transform that makes bounding box a unit-sized square

This is used by clip|mask|gradient units

source

pub fn transform(&self, tr: Transform) -> BBox

Compute new bounding box such that it will include original bounding box after transformation

Trait Implementations§

source§

impl Clone for BBox

source§

fn clone(&self) -> BBox

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BBox

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for BBox

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for BBox

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromStr for BBox

§

type Err = SvgParserError

The associated error which can be returned from parsing.
source§

fn from_str(string: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for BBox

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for BBox

source§

fn eq(&self, other: &BBox) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for BBox

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for BBox

source§

impl StructuralPartialEq for BBox

Auto Trait Implementations§

§

impl Freeze for BBox

§

impl RefUnwindSafe for BBox

§

impl Send for BBox

§

impl Sync for BBox

§

impl Unpin for BBox

§

impl UnwindSafe for BBox

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,