Struct pdf_writer::writers::StreamShading

source ·
pub struct StreamShading<'a> { /* private fields */ }
Expand description

Writer for a embedded file stream.

This struct is created by Chunk::stream_shading.

Implementations§

source§

impl<'a> StreamShading<'a>

source

pub fn shading_type(&mut self, kind: StreamShadingType) -> &mut Self

Write the /ShadingType attribute.

Sets the type of shading. The available and required attributes change depending on this. Required.

source

pub fn color_space(&mut self) -> ColorSpace<'_>

Start writing the /ColorSpace attribute.

Sets the color space of the shading function. May not be a Pattern space. Required.

source

pub fn background( &mut self, background: impl IntoIterator<Item = f32> ) -> &mut Self

Write the /Background attribute.

Sets the background color of the area to be shaded. The background iterator must contain exactly as many elements as the current color space has dimensions.

source

pub fn bbox(&mut self, bbox: Rect) -> &mut Self

Write the /BBox attribute.

Sets the bounding box of the shading in the target coordinate system.

source

pub fn anti_alias(&mut self, anti_alias: bool) -> &mut Self

Write the /AntiAlias attribute.

Sets whether to anti-alias the shading.

source

pub fn function(&mut self, function: Ref) -> &mut Self

Write the /Function attribute.

Sets the function to use for shading. Number of in- and outputs depends on shading type. Optional.

source

pub fn bits_per_coordinate(&mut self, bits: i32) -> &mut Self

Write the /BitsPerCoordinate attribute.

Sets how many bits are used to represent each vertex coordinate. Can be any power of 2 between 1 and 32. Required.

source

pub fn bits_per_component(&mut self, bits: i32) -> &mut Self

Write the /BitsPerComponent attribute.

Sets how many bits are used to represent each color component. Can be any power of 2 between 1 and 16. Required.

source

pub fn bits_per_flag(&mut self, bits: i32) -> &mut Self

Write the /BitsPerFlag attribute.

Sets how many bits are used to represent the vertices’ edge flags. Can be 0, 1, or 2. Required for type 4, 6, and 7.

source

pub fn decode(&mut self, decode: impl IntoIterator<Item = f32>) -> &mut Self

Write the /Decode attribute.

Sets the ranges of the vertices’ coordinates. Required.

source

pub fn vertices_per_row(&mut self, vertices: i32) -> &mut Self

Write the /VerticesPerRow attribute.

Sets how many vertices are in each row of the lattice. Must be greater than 2. Required for type 5.

Methods from Deref<Target = Stream<'a>>§

source

pub fn filter(&mut self, filter: Filter) -> &mut Self

Write the /Filter attribute.

source

pub fn decode_parms(&mut self) -> DecodeParms<'_>

Start writing the /DecodeParms attribute.

This is a dictionary that specifies parameters to be used in decoding the stream data using the filter specified by the /Filter attribute.

Methods from Deref<Target = Dict<'a>>§

source

pub fn len(&self) -> i32

The number of written pairs.

source

pub fn is_empty(&self) -> bool

Whether no pairs have been written so far.

source

pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>

Start writing a pair with an arbitrary value.

source

pub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self

Write a pair with a primitive value.

This is a shorthand for dict.insert(key).primitive(value).

source

pub fn pairs<'n, T: Primitive>( &mut self, pairs: impl IntoIterator<Item = (Name<'n>, T)> ) -> &mut Self

Write a sequence of pairs with primitive values.

Trait Implementations§

source§

impl<'a> Deref for StreamShading<'a>

§

type Target = Stream<'a>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for StreamShading<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for StreamShading<'a>

§

impl<'a> RefUnwindSafe for StreamShading<'a>

§

impl<'a> Send for StreamShading<'a>

§

impl<'a> Sync for StreamShading<'a>

§

impl<'a> Unpin for StreamShading<'a>

§

impl<'a> !UnwindSafe for StreamShading<'a>

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> Finish for T

source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.