pub struct DeviceRect { /* private fields */ }Expand description
A rectangle of whole device pixels, measured from the top-left corner of the page’s full device box (the box the render transform maps the page to, whose size is the whole-page render’s pixmap size).
Validated at construction: neither side is zero, neither exceeds
MAX_TARGET_DIMENSION — the largest pixmap a backend allocates — and
the far edges fit in a u32. Whether it lies inside a particular page’s
device box is the render’s to check, since only the render knows the box.
use pdfrum_render::DeviceRect;
let tile = DeviceRect::new(512, 256, 256, 256)?;
assert_eq!((tile.x(), tile.y(), tile.width(), tile.height()), (512, 256, 256, 256));
assert!(DeviceRect::new(0, 0, 0, 10).is_err());Implementations§
Source§impl DeviceRect
impl DeviceRect
Sourcepub fn new(x: u32, y: u32, width: u32, height: u32) -> Result<DeviceRect, Error>
pub fn new(x: u32, y: u32, width: u32, height: u32) -> Result<DeviceRect, Error>
The rectangle with its top-left corner at (x, y) and the given
size, in device pixels.
§Errors
Error::TargetEmpty when width or height is zero, and
Error::TargetTooLarge when either exceeds MAX_TARGET_DIMENSION
or when x + width or y + height overflows a u32.
Trait Implementations§
Source§impl Clone for DeviceRect
impl Clone for DeviceRect
impl Copy for DeviceRect
Source§impl Debug for DeviceRect
impl Debug for DeviceRect
impl Eq for DeviceRect
Source§impl Hash for DeviceRect
impl Hash for DeviceRect
Source§impl PartialEq for DeviceRect
impl PartialEq for DeviceRect
impl StructuralPartialEq for DeviceRect
Auto Trait Implementations§
impl Freeze for DeviceRect
impl RefUnwindSafe for DeviceRect
impl Send for DeviceRect
impl Sync for DeviceRect
impl Unpin for DeviceRect
impl UnsafeUnpin for DeviceRect
impl UnwindSafe for DeviceRect
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