pub struct FunctionShading<'a> { /* private fields */ }
Expand description
Writer for a shading dictionary. PDF 1.3+.
This struct is created by Chunk::function_shading
and
ShadingPattern::function_shading
.
Implementations§
source§impl<'a> FunctionShading<'a>
impl<'a> FunctionShading<'a>
sourcepub fn shading_type(&mut self, kind: FunctionShadingType) -> &mut Self
pub fn shading_type(&mut self, kind: FunctionShadingType) -> &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<'_>
Start writing 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 function to use for shading. Number of in- and outputs depends on shading type. Required for type 1, 2, and 3, optional otherwise.
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>>§
sourcepub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
Start writing a pair with an arbitrary value.
sourcepub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self
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)
.
sourcepub fn pairs<'n, T: Primitive>(
&mut self,
pairs: impl IntoIterator<Item = (Name<'n>, T)>,
) -> &mut Self
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.