pub struct Quad {
pub top_left: Point,
pub top_right: Point,
pub bottom_left: Point,
pub bottom_right: Point,
}Expand description
One quadrilateral for a text-markup annotation (/QuadPoints).
Eight numbers are written in top-left, top-right, bottom-left,
bottom-right order — the order Rotero writes and the order
pdfrum_doc::annot reads as left/bottom = bl, right/top = tr.
The read path returns axis-aligned Rects via
pdfrum_doc::Annotation::quad_points; Quad is the write-side type for
the same geometry. Convert with Quad::from_rect or From<Rect>.
Fields§
§top_left: PointTop-left corner in page space.
top_right: PointTop-right corner in page space.
bottom_left: PointBottom-left corner in page space.
bottom_right: PointBottom-right corner in page space.
Implementations§
Source§impl Quad
impl Quad
Sourcepub fn from_rect(rect: Rect) -> Self
pub fn from_rect(rect: Rect) -> Self
An axis-aligned quadrilateral from a rectangle: corners in tl, tr, bl, br order.
use pdfrum_edit::Quad;
use kurbo::Rect;
let q = Quad::from_rect(Rect::new(10.0, 20.0, 110.0, 40.0));
assert_eq!(q.top_left, kurbo::Point::new(10.0, 40.0));
assert_eq!(q.bottom_right, kurbo::Point::new(110.0, 20.0));Trait Implementations§
impl Copy for Quad
Source§impl From<Rect> for Quad
impl From<Rect> for Quad
Source§fn from(rect: Rect) -> Self
fn from(rect: Rect) -> Self
Delegates to Quad::from_rect.
use pdfrum_edit::Quad;
use kurbo::Rect;
let q: Quad = Rect::new(10.0, 20.0, 110.0, 40.0).into();
assert_eq!(q, Quad::from_rect(Rect::new(10.0, 20.0, 110.0, 40.0)));impl StructuralPartialEq for Quad
Auto Trait Implementations§
impl Freeze for Quad
impl RefUnwindSafe for Quad
impl Send for Quad
impl Sync for Quad
impl Unpin for Quad
impl UnsafeUnpin for Quad
impl UnwindSafe for Quad
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.