pub struct LineSpec { /* private fields */ }Expand description
A line annotation (/Subtype /Line).
use kurbo::{Point, Rect};
use peniko::Color;
use pdfrum_edit::{AnnotSpec, LineEndingStyle, LineSpec};
let spec: AnnotSpec = LineSpec::new(
Rect::new(0.0, 0.0, 100.0, 20.0),
Color::from_rgb8(255, 0, 0),
Point::new(0.0, 0.0),
Point::new(100.0, 20.0),
)
.endings(LineEndingStyle::OpenArrow, LineEndingStyle::ClosedArrow)
.into();Implementations§
Source§impl LineSpec
impl LineSpec
Sourcepub fn new(rect: Rect, color: Color, start: Point, end: Point) -> Self
pub fn new(rect: Rect, color: Color, start: Point, end: Point) -> Self
A line from start to end, with /Rect as its bounding box.
Sourcepub fn border(self, border: AnnotBorder) -> Self
pub fn border(self, border: AnnotBorder) -> Self
Sets /BS width and style. Ending decorations scale with the width.
Sourcepub fn endings(self, start: LineEndingStyle, end: LineEndingStyle) -> Self
pub fn endings(self, start: LineEndingStyle, end: LineEndingStyle) -> Self
Sets the /LE ending styles. Omitted by default.
Source§impl LineSpec
impl LineSpec
A line annotation.
Sets /T, the author.
Sourcepub fn name(self, name: impl Into<String>) -> AnnotWrite
pub fn name(self, name: impl Into<String>) -> AnnotWrite
A line annotation.
Sets /NM, the annotation’s unique name.
Sourcepub fn modified(self, modified: impl Into<String>) -> AnnotWrite
pub fn modified(self, modified: impl Into<String>) -> AnnotWrite
A line annotation.
Sets /M, the modification date.
Sourcepub fn flags(self, flags: AnnotFlags) -> AnnotWrite
pub fn flags(self, flags: AnnotFlags) -> AnnotWrite
A line annotation.
Sets /F, the annotation flags.
Sourcepub fn meta(self, meta: AnnotMeta) -> AnnotWrite
pub fn meta(self, meta: AnnotMeta) -> AnnotWrite
A line annotation.
Sets every metadata field at once.
Trait Implementations§
Source§impl From<LineSpec> for AnnotWrite
impl From<LineSpec> for AnnotWrite
impl StructuralPartialEq for LineSpec
Auto Trait Implementations§
impl Freeze for LineSpec
impl RefUnwindSafe for LineSpec
impl Send for LineSpec
impl Sync for LineSpec
impl Unpin for LineSpec
impl UnsafeUnpin for LineSpec
impl UnwindSafe for LineSpec
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.