#[non_exhaustive]pub struct ConicShading {
pub name: String,
pub center: Point,
pub domain: [f64; 4],
pub matrix: Option<[f64; 6]>,
pub color_stops: Vec<ColorStop>,
}Expand description
Conic (angular / “sweep”) gradient, emitted as an exact Type 1
function-based shading (ISO 32000-1 §8.7.4.5.2) whose /Function is a real
Type 4 PostScript calculator: the colour is a resolution-independent
function of the angle around center, not a piecewise mesh approximation.
Marked #[non_exhaustive]: build via ConicShading::new /
with_matrix so future additive fields stay
non-breaking.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringShading name for referencing.
center: PointCentre of the angular sweep, in the shading’s domain coordinates.
domain: [f64; 4]Domain [xmin xmax ymin ymax] the function is evaluated over.
matrix: Option<[f64; 6]>Optional matrix mapping domain space to the shading target space.
color_stops: Vec<ColorStop>Colour stops swept from angle 0 (t=0) to a full turn (t=1).
Implementations§
Source§impl ConicShading
impl ConicShading
Sourcepub fn new(
name: impl Into<String>,
center: Point,
domain: [f64; 4],
color_stops: Vec<ColorStop>,
) -> Self
pub fn new( name: impl Into<String>, center: Point, domain: [f64; 4], color_stops: Vec<ColorStop>, ) -> Self
Create a conic gradient centred at center over domain.
Sourcepub fn with_matrix(self, matrix: [f64; 6]) -> Self
pub fn with_matrix(self, matrix: [f64; 6]) -> Self
Set the shading-to-target transformation matrix.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate stops (non-empty, ascending) and domain (min < max).
Sourcepub fn to_pdf_dictionary(&self) -> Result<Dictionary>
pub fn to_pdf_dictionary(&self) -> Result<Dictionary>
Build the Type 1 function-based shading dictionary with a real Type 4
PostScript /Function (angle prologue + colour ramp) and the required
/ColorSpace. The /Function is inlined as a stream; the writer hoists
it to an indirect object (a stream cannot be a dictionary value).
Trait Implementations§
Source§impl Clone for ConicShading
impl Clone for ConicShading
Source§fn clone(&self) -> ConicShading
fn clone(&self) -> ConicShading
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more