Module image_filters
Expand description
Factory functions for creating crate::ImageFilters. For filters that take an input
filter, None means the dynamic source image is used.
Structs§
- ArithmeticFP
Inputs - The inputs of
arithmetic()packed into a struct: the four coefficients and whether the RGB channels are clamped to the calculated alpha. - Crop
Rect - This is just a convenience type to allow passing
IRects,Rects, and optional references to those types as a crop rect for the image filter factories. It’s not intended to be used directly.
Enums§
Functions§
- arithmetic
- Create a filter that implements a custom blend mode. Each output pixel is the result of combining the corresponding background and foreground pixels using the 4 coefficients: k1 * foreground * background + k2 * foreground + k3 * background + k4
- blend
- This filter takes an
crate::BlendModeand uses it to composite the two filters together. - blur
- Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode is used when the blur kernel goes outside the input image.
- color_
filter - Create a filter that applies the color filter to the input filter results.
- compose
- Create a filter that composes ‘inner’ with ‘outer’, such that the results of ‘inner’ are treated as the source bitmap passed to ‘outer’, i.e. result = outer(inner(source)).
- crop
- Create a filter that applies a crop to the result of the ‘input’ filter. Pixels within the
crop rectangle are unmodified from what ‘input’ produced. Pixels outside of crop match the
provided
TileMode(defaulting toDecal). - dilate
- Create a filter that dilates each input pixel’s channel values to the max value within the given radii along the x and y axes.
- displacement_
map - Create a filter that moves each pixel in its color input based on an (x,y) vector encoded
in its displacement input filter. Two color components of the displacement image are
mapped into a vector as
scale * (color[xChannel], color[yChannel]), where the channel selectors are one of R, G, B, or A. - distant_
lit_ diffuse - Create a filter that calculates the diffuse illumination from a distant light source, interpreting the alpha channel of the input as the height profile of the surface (to approximate normal vectors).
- distant_
lit_ specular - Create a filter that calculates the specular illumination from a distant light source, interpreting the alpha channel of the input as the height profile of the surface (to approximate normal vectors).
- drop_
shadow - Create a filter that draws a drop shadow under the input content. This filter produces an image that includes the inputs’ content.
- drop_
shadow_ only - Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except that the resulting image does not include the input content. This allows the shadow and input to be composed by a filter DAG in a more flexible manner.
- empty
- Create a filter that always produces transparent black.
- erode
- Create a filter that erodes each input pixel’s channel values to the minimum channel value within the given radii along the x and y axes.
- image
- Create a filter that draws the ‘src_rect’ portion of image into ‘dst_rect’ using the given
filter quality. Similar to
crate::Canvas::draw_image_rect(). - magnifier
- Create a filter that fills ‘lens_bounds’ with a magnification of the input.
- matrix_
convolution - Create a filter that applies an NxM image processing kernel to the input image. This can be used to produce effects such as sharpening, blurring, edge detection, etc.
- matrix_
transform - Create a filter that transforms the input image by ‘matrix’. This matrix transforms the
local space, which means it effectively happens prior to any transformation coming from the
crate::Canvasinitiating the filtering. - merge
- Create a filter that merges the filters together by drawing their results in order with src-over blending.
- offset
- Create a filter that offsets the input filter by the given vector.
- picture
- Create a filter that produces the
Pictureas its output, clipped to both ‘target_rect’ and the picture’s internal cull rect. - point_
lit_ diffuse - Create a filter that calculates the diffuse illumination from a point light source, using alpha channel of the input as the height profile of the surface (to approximate normal vectors).
- point_
lit_ specular - Create a filter that calculates the specular illumination from a point light source, using alpha channel of the input as the height profile of the surface (to approximate normal vectors).
- runtime_
shader - Create a filter that evaluates a
crate::RuntimeEffectchild shader for each pixel, binding it toinput. The equivalent toruntime_shader_with_options()with a sample radius of 0. See that function for details. - runtime_
shader_ with_ options - Creates a runtime-shader image filter with a child-shader sampling radius and optionally restricts its output to its input bounds.
- runtime_
shader_ with_ output_ bounds - Creates a runtime-shader image filter and optionally restricts its output to its input bounds.
- shader
- Create a filter that fills the output with the per-pixel evaluation of the
Shader. The shader is defined in the image filter’s local coordinate system, so will automatically be affected bycrate::Canvas’s transform. - shader_
with_ dither - Same as
shader(), but with an explicitdithersetting. - spot_
lit_ diffuse - Create a filter that calculates the diffuse illumination from a spot light source, using alpha channel of the input as the height profile of the surface (to approximate normal vectors). The spot light is restricted to be within ‘cutoff_angle’ of the vector between the location and target.
- spot_
lit_ specular - Create a filter that calculates the specular illumination from a spot light source, using alpha channel of the input as the height profile of the surface (to approximate normal vectors). The spot light is restricted to be within ‘cutoff_angle’ of the vector between the location and target.
- tile
- Create a tile image filter.