Struct jiao::core::image_filter::ImageFilter

source ·
pub struct ImageFilter {}
Expand description

Base class for image filters.

If one is installed in the paint, then all drawing occurs as usual, but it is as if the drawing happened into an offscreen (before the xfermode is applied). This offscreen bitmap will then be handed to the imagefilter, who in turn creates a new bitmap which is what will finally be drawn to the device (using the original xfermode).

The local space of image filters matches the local space of the drawn geometry. For instance if there is rotation on the canvas, the blur will be computed along those rotated axes and not in the device space. In order to achieve this result, the actual drawing of the geometry may happen in an unrotated coordinate system so that the filtered image can be computed more easily, and then it will be post transformed to match what would have been produced if the geometry were drawn with the total canvas matrix to begin with.

Implementations§

source§

impl ImageFilter

source

pub const fn filter_bounds( &self, _src: &IRect, _ctm: &Matrix, _dir: MapDirection, _input_rect: Option<&IRect> ) -> IRect

Map a device-space rect recursively forward or backward through the filter DAG.

MapDirection::Forward is used to determine which pixels of the destination canvas a source image rect would touch after filtering. MapDirection::Reverse is used to determine which rect of the source image would be required to fill the given rect (typically, clip bounds). Used for clipping and temp-buffer allocations, so the result need not be exact, but should never be smaller than the real answer. The default implementation recursively unions all input bounds, or returns the source rect if no inputs.

In Reverse mode, input_rect is the device-space bounds of the input pixels. In Forward mode it should always be null. If input_rect is null in Reverse mode the resulting answer may be incorrect.

source

pub fn is_color_filter_node(&self, _filter: &mut ColorFilter) -> bool

Returns whether this image filter is a color filter and puts the color filter into the “filter” parameter if it can.

Does nothing otherwise. If this returns false, then the filter is unchanged. If this returns true, then if filter is not null, it must be set to a ref’d colorfitler (i.e. it may not be set to NULL).

source

pub fn as_a_color_filter(&self, _filter: &mut ColorFilter) -> bool

Returns true (and optionally returns a ref’d filter) if this imagefilter can be completely replaced by the returned colorfilter. i.e. the two effects will affect drawing in the same way.

source

pub fn count_inputs(&self) -> i32

Returns the number of inputs this filter will accept (some inputs can be NULL).

source

pub fn get_input(&self, _index: i32) -> &Self

Returns the input filter at a given index, or NULL if no input is connected. The indices used are filter-specific.

source

pub fn can_compute_fast_bounds(&self) -> bool

Can this filter DAG compute the resulting bounds of an object-space rectangle?

source

pub fn with_local_matrix(_matrix: &Matrix) -> Option<Self>

If this filter can be represented by another filter + a local_matrix, return that filter, else return null.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.