Type Alias freya_engine::prelude::Shader

pub type Shader = RCHandle<SkShader>;

Aliased Type§

struct Shader(/* private fields */);

Implementations

§

impl RCHandle<SkShader>

Shaders specify the source color(s) for what is being drawn. If a paint has no shader, then the paint’s color is used. If the paint has a shader, then the shader’s color(s) are use instead, but they are modulated by the paint’s alpha. This makes it easy to create a shader once (e.g. bitmap tiling or gradient) and then change its transparency w/o having to modify the original shader… only the paint’s alpha needs to be modified.

pub fn is_opaque(&self) -> bool

Returns true if the shader is guaranteed to produce only opaque colors, subject to the crate::Paint using the shader to apply an opaque alpha value. Subclasses should override this to allow some optimizations.

pub fn image( &self ) -> Option<(RCHandle<SkImage>, Matrix, (SkTileMode, SkTileMode))>

Returns iff this shader is backed by a single Image. If not, returns None.

pub fn is_a_image(&self) -> bool

pub fn with_local_matrix(&self, matrix: &Matrix) -> RCHandle<SkShader>

Return a shader that will apply the specified local_matrix to this shader. The specified matrix will be applied before any matrix associated with this shader.

pub fn with_color_filter( &self, color_filter: impl Into<RCHandle<SkColorFilter>> ) -> RCHandle<SkShader>

Create a new shader that produces the same colors as invoking this shader and then applying the color filter.

pub fn with_working_color_space( &self, color_space: impl Into<RCHandle<SkColorSpace>> ) -> RCHandle<SkShader>

Return a shader that will compute this shader in a specific color space. By default, all shaders operate in the destination (surface) color space. The results of a shader are still always converted to the destination - this API has no impact on simple shaders or images. Primarily, it impacts shaders that perform mathematical operations, like Blend shaders, or runtime shaders.

§

impl RCHandle<SkShader>

pub fn fractal_perlin_noise( base_frequency: (f32, f32), num_octaves: usize, seed: f32, tile_size: impl Into<Option<ISize>> ) -> Option<RCHandle<SkShader>>

pub fn turbulence_perlin_noise( base_frequency: (f32, f32), num_octaves: usize, seed: f32, tile_size: impl Into<Option<ISize>> ) -> Option<RCHandle<SkShader>>

§

impl RCHandle<SkShader>

pub fn linear_gradient<'a>( points: (impl Into<Point>, impl Into<Point>), colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn linear_gradient_with_interpolation<'a>( points: (impl Into<Point>, impl Into<Point>), colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn radial_gradient<'a>( center: impl Into<Point>, radius: f32, colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn radial_gradient_with_interpolation<'a>( center_and_radius: (impl Into<Point>, f32), colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn two_point_conical_gradient<'a>( start: impl Into<Point>, start_radius: f32, end: impl Into<Point>, end_radius: f32, colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn two_point_conical_gradient_with_interpolation<'a>( start_and_radius: (impl Into<Point>, f32), end_and_radius: (impl Into<Point>, f32), colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn sweep_gradient<'a>( center: impl Into<Point>, colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, angles: impl Into<Option<(f32, f32)>>, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

pub fn sweep_gradient_with_interpolation<'a>( center: impl Into<Point>, colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, angles: impl Into<Option<(f32, f32)>>, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>> ) -> Option<RCHandle<SkShader>>

Trait Implementations

§

impl<N> AsRef<RCHandle<N>> for RCHandle<N>
where N: NativeRefCounted,

§

fn as_ref(&self) -> &RCHandle<N>

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<N> Clone for RCHandle<N>
where N: NativeRefCounted,

§

fn clone(&self) -> RCHandle<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<H> ConditionallySend for RCHandle<H>
where H: NativeRefCountedBase,

RCHandle<H> is conditionally Send and can be sent to another thread when its reference count is 1.

§

fn can_send(&self) -> bool

Returns true if the handle can be sent to another thread.
§

fn wrap_send(self) -> Result<Sendable<RCHandle<H>>, RCHandle<H>>

Wrap the handle in a type that can be sent to another thread and unwrapped there. Read more
§

impl Debug for RCHandle<SkShader>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for RCHandle<SkShader>

§

fn default() -> RCHandle<SkShader>

Returns the “default value” for a type. Read more
§

impl<N> Drop for RCHandle<N>
where N: NativeRefCounted,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<N> Flattenable for RCHandle<N>
where N: NativeFlattenable + NativeRefCountedBase,

§

fn type_name(&self) -> &CStr

§

fn serialize(&self) -> RCHandle<SkData>

§

fn deserialize(data: &[u8]) -> Option<RCHandle<N>>

§

impl<N> From<&RCHandle<N>> for RCHandle<N>
where N: NativeRefCounted,

A reference counted handle is cheap to clone, so we do support a conversion from a reference to a ref counter to an owned handle.

§

fn from(rch: &RCHandle<N>) -> RCHandle<N>

Converts to this type from the input type.
§

impl<N> PartialEq for RCHandle<N>
where N: NativeRefCounted + NativePartialEq,

§

fn eq(&self, rhs: &RCHandle<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<N> PointerWrapper<N> for RCHandle<N>
where N: NativeRefCounted,

§

fn wrap(ptr: *mut N) -> Option<RCHandle<N>>

Wraps a native pointer into a wrapper type. Returns None if the pointer is null.
§

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.
§

fn inner(&self) -> &N

Access the wrapped pointer.
§

fn inner_mut(&mut self) -> &mut N

Access the wrapped pointer.
§

impl Send for RCHandle<SkShader>

§

impl Sync for RCHandle<SkShader>