pub struct ContentRegion {
pub pixels: Region,
pub normalized: [f32; 4],
}Expand description
Where the image content sits in a destination: in pixels, and as
[xmin, ymin, xmax, ymax] normalized by the destination size, the form
unletter_norm and the semantic decoder take.
Fields§
§pixels: RegionThe content rectangle in destination pixels.
normalized: [f32; 4]The content rectangle normalized by the destination size.
Implementations§
Source§impl ContentRegion
impl ContentRegion
Sourcepub fn new(pixels: Region, dst_w: usize, dst_h: usize) -> Self
pub fn new(pixels: Region, dst_w: usize, dst_h: usize) -> Self
The region of pixels in a dst_w×dst_h destination.
Sourcepub fn letterboxed(&self) -> Option<[f32; 4]>
pub fn letterboxed(&self) -> Option<[f32; 4]>
The normalized content rectangle when it does not fill the
destination (a letterbox), else None.
Sourcepub fn unletter(&self, b: BoundingBox) -> BoundingBox
pub fn unletter(&self, b: BoundingBox) -> BoundingBox
Map a box normalized to the destination back to the content, i.e. to
the source image (see unletter_norm).
Trait Implementations§
Source§impl Clone for ContentRegion
impl Clone for ContentRegion
impl Copy for ContentRegion
Source§impl Debug for ContentRegion
impl Debug for ContentRegion
Source§impl PartialEq for ContentRegion
impl PartialEq for ContentRegion
impl StructuralPartialEq for ContentRegion
Auto Trait Implementations§
impl Freeze for ContentRegion
impl RefUnwindSafe for ContentRegion
impl Send for ContentRegion
impl Sync for ContentRegion
impl Unpin for ContentRegion
impl UnsafeUnpin for ContentRegion
impl UnwindSafe for ContentRegion
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more