pub struct EncodedShadingPattern {
pub base_transform: Affine,
pub shading_type: EncodedShadingType,
/* private fields */
}Expand description
A shading pattern that was encoded so it can be sampled.
Fields§
§base_transform: AffineThe base transform of the shading pattern.
shading_type: EncodedShadingTypeThe encoded shading type.
Implementations§
Source§impl EncodedShadingPattern
impl EncodedShadingPattern
Sourcepub fn sample_texture(
&self,
bbox: Rect,
scale: f32,
f: impl FnMut([f32; 4]),
) -> (u32, u32, Affine)
pub fn sample_texture( &self, bbox: Rect, scale: f32, f: impl FnMut([f32; 4]), ) -> (u32, u32, Affine)
Sample the shading on a pixel grid covering bbox, with scale
pixels per unit of bbox.
The callback is invoked once per pixel in row-major order with the
straight (non-premultiplied) RGBA sample, letting callers apply their
own conversion. Returns the dimensions of the grid (see
texture_dimensions) and the transform from grid space to the space
of bbox. No size cap is applied — callers that need to bound the
texture size should check texture_dimensions first.
Sourcepub fn render_texture(&self, bbox: Rect, scale: f32) -> ShadingTexture
pub fn render_texture(&self, bbox: Rect, scale: f32) -> ShadingTexture
Rasterize the shading into a straight (non-premultiplied) RGBA8
texture covering bbox, with scale pixels per unit of bbox.
See sample_texture for the grid semantics.
Trait Implementations§
Source§impl Clone for EncodedShadingPattern
impl Clone for EncodedShadingPattern
Auto Trait Implementations§
impl !RefUnwindSafe for EncodedShadingPattern
impl !UnwindSafe for EncodedShadingPattern
impl Freeze for EncodedShadingPattern
impl Send for EncodedShadingPattern
impl Sync for EncodedShadingPattern
impl Unpin for EncodedShadingPattern
impl UnsafeUnpin for EncodedShadingPattern
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