Skip to main content

AppearanceStreamBuilder

Struct AppearanceStreamBuilder 

Source
pub struct AppearanceStreamBuilder { /* private fields */ }
Expand description

Builds content stream operations for annotation appearance streams.

All coordinates are in the Form XObject’s local coordinate system, where (0,0) is the bottom-left of the annotation rectangle.

Implementations§

Source§

impl AppearanceStreamBuilder

Source

pub fn new(width: f64, height: f64) -> Self

Create a new builder for an appearance stream with the given dimensions.

Source

pub fn save_state(&mut self) -> &mut Self

Save the current graphics state.

Source

pub fn restore_state(&mut self) -> &mut Self

Restore the graphics state.

Source

pub fn set_fill_color(&mut self, color: &AppearanceColor) -> &mut Self

Set the fill color (RGB).

Source

pub fn set_stroke_color(&mut self, color: &AppearanceColor) -> &mut Self

Set the stroke color (RGB).

Source

pub fn set_line_width(&mut self, width: f64) -> &mut Self

Set the line width for stroked paths.

Source

pub fn set_dash_pattern(&mut self, dash: &[f64], phase: f64) -> &mut Self

Set the dash pattern for stroked paths.

Source

pub fn rect(&mut self, x: f64, y: f64, w: f64, h: f64) -> &mut Self

Draw a rectangle path.

Source

pub fn move_to(&mut self, x: f64, y: f64) -> &mut Self

Move to a point (start a new subpath).

Source

pub fn line_to(&mut self, x: f64, y: f64) -> &mut Self

Line to a point.

Source

pub fn curve_to( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64, ) -> &mut Self

Cubic bezier curve.

Source

pub fn close_path(&mut self) -> &mut Self

Close the current subpath.

Source

pub fn stroke(&mut self) -> &mut Self

Stroke the current path.

Source

pub fn fill(&mut self) -> &mut Self

Fill the current path (non-zero winding rule).

Source

pub fn fill_and_stroke(&mut self) -> &mut Self

Fill then stroke the current path.

Source

pub fn close_fill_and_stroke(&mut self) -> &mut Self

Close, fill and stroke.

Source

pub fn filled_rect(&mut self, color: &AppearanceColor) -> &mut Self

Add a filled rectangle covering the full annotation area.

Source

pub fn stroked_rect( &mut self, color: &AppearanceColor, line_width: f64, ) -> &mut Self

Add a stroked rectangle (border) inside the annotation area.

Source

pub fn filled_stroked_rect( &mut self, fill: &AppearanceColor, stroke: &AppearanceColor, line_width: f64, ) -> &mut Self

Draw a filled and stroked rectangle.

Source

pub fn ellipse(&mut self) -> &mut Self

Draw an ellipse (circle if width == height) using cubic bezier approximation.

Source

pub fn line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64) -> &mut Self

Draw a line between two points in local coordinates.

Source

pub fn text( &mut self, text: &str, font_name: &str, font_size: f64, x: f64, y: f64, color: &AppearanceColor, ) -> &mut Self

Add text to the appearance stream.

Source

pub fn ops_push_raw(&mut self, op: Operation) -> &mut Self

Push a raw operation (for advanced use cases like ExtGState references).

Source

pub fn encode(self) -> Result<Vec<u8>, String>

Encode the operations into content stream bytes.

Source

pub fn width(&self) -> f64

Return the width of the appearance.

Source

pub fn height(&self) -> f64

Return the height of the appearance.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V