pub struct VisionRaster {
pub width: u32,
pub height: u32,
pub format: VisionPixelFormat,
pub data: Vec<u8>,
}Expand description
A page (or crop) rasterized for vision input, row-major.
Fields§
§width: u32Width in pixels.
height: u32Height in pixels.
format: VisionPixelFormatPixel layout of Self::data.
data: Vec<u8>Pixel bytes, row-major, top-left origin.
Implementations§
Source§impl VisionRaster
impl VisionRaster
Sourcepub fn crop_pixels(
&self,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Option<Self>
pub fn crop_pixels( &self, x: u32, y: u32, width: u32, height: u32, ) -> Option<Self>
Crop a pixel rectangle out of this raster (top-left origin).
Returns None when the rectangle is empty or lies outside the raster.
Sourcepub fn crop_points(
&self,
bbox: [f64; 4],
page_size_points: (f64, f64),
dpi: u32,
) -> VisionResult<Self>
pub fn crop_points( &self, bbox: [f64; 4], page_size_points: (f64, f64), dpi: u32, ) -> VisionResult<Self>
Crop a bbox in page points out of this raster.
bbox is [x0, y0, x1, y1] in PDF points with the origin at the
bottom-left (the crate::PageBox convention). page_size_points is
the page’s (width, height) in points, normally
crate::PageGeometry::effective_dimensions. The mapping is
pixels = points * dpi / 72, with the Y axis flipped to the raster’s
top-left origin. The bbox is clamped to the page; an empty intersection
is an error.
Trait Implementations§
Source§impl Clone for VisionRaster
impl Clone for VisionRaster
Auto Trait Implementations§
impl Freeze for VisionRaster
impl RefUnwindSafe for VisionRaster
impl Send for VisionRaster
impl Sync for VisionRaster
impl Unpin for VisionRaster
impl UnsafeUnpin for VisionRaster
impl UnwindSafe for VisionRaster
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<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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