Create an image filter of the given kind.
The kind names the effect and the remaining arguments are the ones that
kind takes, matching the Make method of the same name. Where those return
null for arguments Skia rejects, the constructor throws instead.
Most kinds end with an optional input filter, which is how they chain;
omitting it reads from the layer being drawn.
ctx.imageFilter = new ImageFilter("blur", 4, 4)
Optionalinput: ImageFilter | nullApply inner, then outer. See ImageFilter.MakeCompose.
Gaussian blur. See ImageFilter.MakeBlur.
OptionaltileMode: "repeat" | "clamp" | "mirror" | "decal"Optionalinput: ImageFilter | nullSource plus its shadow. See ImageFilter.MakeDropShadow.
Optionalinput: ImageFilter | nullThe shadow alone. See ImageFilter.MakeDropShadowOnly.
Optionalinput: ImageFilter | nullTranslate. See ImageFilter.MakeOffset.
Optionalinput: ImageFilter | nullMorphological dilation. See ImageFilter.MakeDilate.
Optionalinput: ImageFilter | nullOptionalcrop: [number, number, number, number] | null
🧪 Bounds the kernel's domain as well as clipping the output.
Morphological erosion. See ImageFilter.MakeErode.
Optionalinput: ImageFilter | nullOptionalcrop: [number, number, number, number] | null
🧪 Bounds the kernel's domain as well as clipping the output.
Draw several filters together. See ImageFilter.MakeMerge.
Repeat a source rect across a destination. See ImageFilter.MakeTile.
Optionalinput: ImageFilter | nullBlend two filters. See ImageFilter.MakeBlend.
Optionalbackground: ImageFilter | nullOptionalforeground: ImageFilter | nullk1fgbg + k2fg + k3bg + k4. See ImageFilter.MakeArithmetic.
OptionalenforcePMColor: booleanOptionalbackground: ImageFilter | nullOptionalforeground: ImageFilter | nullDisplace pixels by a map. See ImageFilter.MakeDisplacementMap.
Optionaldisplacement: ImageFilter | nullOptionalcolor: ImageFilter | nullConvolution kernel. See ImageFilter.MakeMatrixConvolution.
OptionaltileMode: TileModeOptionalconvolveAlpha: booleanOptionalinput: ImageFilter | nullOptionalcrop: [number, number, number, number] | null
🧪 Bounds the kernel's domain as well as clipping the output.
Affine or 3x3 transform. See ImageFilter.MakeMatrixTransform.
Optionalsampling: SamplingModeOptionalinput: ImageFilter | nullFisheye lens. See ImageFilter.MakeMagnifier.
Optionalsampling: SamplingModeOptionalinput: ImageFilter | nullRestrict to a rect. See ImageFilter.MakeCrop.
OptionaltileMode: TileModeOptionalinput: ImageFilter | nullDiffuse light from a direction. See ImageFilter.MakeDistantLitDiffuse.
Optionalinput: ImageFilter | nullDiffuse light from a point. See ImageFilter.MakePointLitDiffuse.
Optionalinput: ImageFilter | nullDiffuse light from a spot. See ImageFilter.MakeSpotLitDiffuse.
Optionalinput: ImageFilter | nullSpecular light from a direction. See ImageFilter.MakeDistantLitSpecular.
Optionalinput: ImageFilter | nullSpecular light from a point. See ImageFilter.MakePointLitSpecular.
Optionalinput: ImageFilter | nullSpecular light from a spot. See ImageFilter.MakeSpotLitSpecular.
Optionalinput: ImageFilter | nullMark filter as deleted. Use-after-delete throws Error.
StaticMakeArithmetic blend: k1fgbg + k2fg + k3bg + k4.
coefficient for fg*bg
coefficient for fg
coefficient for bg
constant offset
OptionalenforcePMColor: boolean
enforce premultiplied color (default true)
Optionalbackground: ImageFilter | null
background filter (or null for source)
Optionalforeground: ImageFilter | null
foreground filter (or null for source)
StaticMakeBlend two image filters using a blend mode.
blend mode ("srcOver", "multiply", "screen", etc.)
Optionalbackground: ImageFilter | null
background filter (or null for source)
Optionalforeground: ImageFilter | null
foreground filter (or null for source)
StaticMakeCreate blur ImageFilter.
horizontal blur radius
vertical blur radius
OptionaltileMode: "repeat" | "clamp" | "mirror" | "decal"
edge behavior: "clamp" | "repeat" | "mirror" | "decal"
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeCreate ImageFilter from ColorFilter.
The color filter to wrap
Optionalinput: ImageFilter | null
Optional previous filter for chaining
ImageFilter or null on Skia internal failure
StaticMakeCompose two ImageFilters (outer applied after inner).
ImageFilter or null on Skia internal failure
StaticMakeCrop filter with optional tile mode.
[x, y, width, height] crop rectangle
OptionaltileMode: TileMode
tile mode for pixels outside rect (default "decal")
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeCreate morphological dilation ImageFilter.
horizontal radius
vertical radius
Optionalinput: ImageFilter | null
optional input filter for chaining
Optionalcrop: [number, number, number, number] | null
🧪 [x, y, width, height] bounding the kernel's domain as
well as clipping the output, so the dilation stops spreading at the
edge rather than spreading and then being cut. Not the same as
composing a separate "crop" filter afterwards.
StaticMakeDisplacement map filter.
color channel for x displacement ("R", "G", "B", "A")
color channel for y displacement ("R", "G", "B", "A")
displacement scale
Optionaldisplacement: ImageFilter | null
displacement map filter (or null for source)
Optionalcolor: ImageFilter | null
color source filter (or null for source)
StaticMakeDiffuse lighting from a distant light source.
[x, y, z] light direction
CSS color of the light
height scale factor
diffuse reflectance coefficient
Optionalinput: ImageFilter | null
optional input filter (alpha as height map)
StaticMakeSpecular lighting from a distant light source.
[x, y, z] light direction
CSS color of the light
height scale factor
specular reflectance coefficient
specular exponent
Optionalinput: ImageFilter | null
optional input filter
StaticMakeCreate drop shadow ImageFilter.
shadow x offset
shadow y offset
horizontal blur radius
vertical blur radius
CSS color string or [r,g,b,a] array (0-1 floats)
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeCreate drop shadow ImageFilter (shadow only, no source image).
shadow x offset
shadow y offset
horizontal blur radius
vertical blur radius
CSS color string or [r,g,b,a] array (0-1 floats)
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeA filter that produces no output.
Empty means an empty result, not an absent filter: anything drawn through
it disappears. Assign null to ctx.imageFilter to draw unfiltered.
StaticMakeCreate morphological erosion ImageFilter.
horizontal radius
vertical radius
Optionalinput: ImageFilter | null
optional input filter for chaining
Optionalcrop: [number, number, number, number] | null
🧪 [x, y, width, height] bounding the kernel's domain as
well as clipping the output. See ImageFilter.MakeDilate.
StaticMakeMagnifier (fisheye) effect.
[x, y, width, height] of lens area
magnification factor
edge distortion width
Optionalsampling: SamplingMode
sampling mode (default "linear")
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeMatrix convolution filter (e.g., sharpen, edge detect).
[width, height] of kernel
convolution kernel (width*height elements)
scale factor applied to result
bias added to result
[x, y] offset for kernel center
OptionaltileMode: TileMode
tile mode for edge handling (default "decal")
OptionalconvolveAlpha: boolean
whether to convolve alpha channel (default true)
Optionalinput: ImageFilter | null
optional input filter for chaining
Optionalcrop: [number, number, number, number] | null
🧪 [x, y, width, height] bounding the kernel's domain as
well as clipping the output. See ImageFilter.MakeDilate.
StaticMakeApply a matrix transformation to the image.
The two lengths are read in different orders, so they are not the same
matrix written two ways. Six elements are [a, b, c, d, e, f] in canvas
transform() order -- b and c are the skews, e and f the
translation -- while nine are plain row-major. A uniform 2x scale is
therefore [2, 0, 0, 2, 0, 0]; the row-major-looking [2, 0, 0, 0, 2, 0]
sets the vertical scale to zero and Skia returns null.
6 elements in transform() order, or 9 row-major
Optionalsampling: SamplingMode
one of the four SamplingMode names (default "linear")
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeMerge multiple ImageFilters into one.
array of filters to merge (null entries allowed)
StaticMakeCreate offset ImageFilter.
x offset
y offset
Optionalinput: ImageFilter | null
optional input filter for chaining
StaticMakeDiffuse lighting from a point light source.
[x, y, z] light position
CSS color of the light
height scale factor
diffuse reflectance coefficient
Optionalinput: ImageFilter | null
optional input filter
StaticMakeSpecular lighting from a point light source.
[x, y, z] light position
CSS color of the light
height scale factor
specular reflectance coefficient
specular exponent
Optionalinput: ImageFilter | null
optional input filter
StaticMakeDiffuse lighting from a spot light source.
[x, y, z] light position
[x, y, z] spot target
how sharply the light fades toward the edge of the cone
the cone's half-angle, in degrees
CSS color of the light
height scale factor
diffuse reflectance coefficient
Optionalinput: ImageFilter | null
optional input filter
StaticMakeSpecular lighting from a spot light source.
[x, y, z] light position
[x, y, z] spot target
how sharply the light fades toward the edge of the cone
the cone's half-angle, in degrees
CSS color of the light
height scale factor
specular reflectance coefficient
specular exponent
Optionalinput: ImageFilter | null
optional input filter
StaticMakeCreate tile ImageFilter.
source rect [x, y, width, height]
destination rect [x, y, width, height]
Optionalinput: ImageFilter | null
optional input filter for chaining
ImageFilter for composable effects. Mirrors CanvasKit.ImageFilter API.
🧪 Not in the HTML Canvas standard.