Struct pdf_writer::writers::Shading
source · [−]pub struct Shading<'a> { /* private fields */ }
Expand description
Writer for a shading dictionary. PDF 1.3+.
This struct is created by PdfWriter::shading
and
ShadingPattern::shading
.
Implementations
sourceimpl<'a> Shading<'a>
impl<'a> Shading<'a>
sourcepub fn shading_type(&mut self, shading_type: ShadingType) -> &mut Self
pub fn shading_type(&mut self, shading_type: ShadingType) -> &mut Self
Write the /ShadingType
attribute.
Sets the type of shading. The available and required attributes change depending on this. Required.
sourcepub fn color_space(&mut self) -> ColorSpace<'_>
pub fn color_space(&mut self) -> ColorSpace<'_>
Write the /ColorSpace
attribute.
Sets the color space of the shading function. May not be a Pattern
space. Required.
sourcepub fn background(
&mut self,
background: impl IntoIterator<Item = f32>
) -> &mut Self
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.
sourcepub fn bbox(&mut self, bbox: Rect) -> &mut Self
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.
sourcepub fn anti_alias(&mut self, anti_alias: bool) -> &mut Self
pub fn anti_alias(&mut self, anti_alias: bool) -> &mut Self
Write the /AntiAlias
attribute.
Sets whether to anti-alias the shading.
sourcepub fn domain(&mut self, domain: [f32; 4]) -> &mut Self
pub fn domain(&mut self, domain: [f32; 4]) -> &mut Self
Write the /Domain
attribute.
Sets the domain of the shading function in a rectangle. Can be used for
function, axial, or radial shadings. Will otherwise default to
[x_min = 0, x_max = 1, y_min = 0, y_max = 1]
sourcepub fn matrix(&mut self, matrix: [f32; 6]) -> &mut Self
pub fn matrix(&mut self, matrix: [f32; 6]) -> &mut Self
Write the /Matrix
attribute.
Maps the shading domain rectangle to the target coordinate system. Can be used for function shadings. Will otherwise default to the identity matrix.
sourcepub fn function(&mut self, function: Ref) -> &mut Self
pub fn function(&mut self, function: Ref) -> &mut Self
Write the /Function
attribute.
Sets the 2-in function to use for shading. Required.
sourcepub fn coords(&mut self, coords: impl IntoIterator<Item = f32>) -> &mut Self
pub fn coords(&mut self, coords: impl IntoIterator<Item = f32>) -> &mut Self
Write the /Coords
attribute.
Sets the coordinates of the start and end of the axis in terms of the target coordinate system. Required for axial (4 items) and radial (6 items; centers and radii) shadings.
Methods from Deref<Target = Dict<'a>>
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Shading<'a>
impl<'a> Send for Shading<'a>
impl<'a> Sync for Shading<'a>
impl<'a> Unpin for Shading<'a>
impl<'a> !UnwindSafe for Shading<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more