pub struct AxialPattern { /* private fields */ }Expand description
Linear gradient between two points in device space.
t = dot(p - p0, axis) / |axis|², clamped to [t0, t1]
(or extended to the nearest endpoint when extend_start / extend_end is set).
Implementations§
Source§impl AxialPattern
impl AxialPattern
Sourcepub fn new(
color0: [u8; 3],
color1: [u8; 3],
p0x: f64,
p0y: f64,
p1x: f64,
p1y: f64,
t0: f64,
t1: f64,
extend_start: bool,
extend_end: bool,
) -> Self
pub fn new( color0: [u8; 3], color1: [u8; 3], p0x: f64, p0y: f64, p1x: f64, p1y: f64, t0: f64, t1: f64, extend_start: bool, extend_end: bool, ) -> Self
Create an axial gradient.
color0,color1: RGB endpoints.(p0x, p0y),(p1x, p1y): axis endpoints in device pixels.t0,t1: parameter range mapping tocolor0/color1. May be inverted (t0 > t1).extend_start/extend_end: extend colour beyond axis endpoints.
§Degenerate case
When p0 == p1 (zero-length axis) every pixel returns None from
t_for, so fill_span writes zeros (per PDF §8.7.4.5).
Trait Implementations§
Source§impl Pattern for AxialPattern
impl Pattern for AxialPattern
Source§fn is_static_color(&self) -> bool
fn is_static_color(&self) -> bool
Return
true if this pattern yields the same colour at every coordinate.
When true, fill_span will be called once and the result reused across
the whole span (optimisation hint only — correctness is not affected).Auto Trait Implementations§
impl Freeze for AxialPattern
impl RefUnwindSafe for AxialPattern
impl Send for AxialPattern
impl Sync for AxialPattern
impl Unpin for AxialPattern
impl UnsafeUnpin for AxialPattern
impl UnwindSafe for AxialPattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more