Skip to content

ColorMatrixFilter

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/scenery/blob/main/js/filters/ColorMatrixFilter.ts for the most up-to-date information.

Overview

A filter that can be represented by a single color matrix operation

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class ColorMatrixFilter

import { ColorMatrixFilter } from 'scenerystack/scenery';

Constructor

new ColorMatrixFilter( m00 : number, m01 : number, m02 : number, m03 : number, m04 : number, m10 : number, m11 : number, m12 : number, m13 : number, m14 : number, m20 : number, m21 : number, m22 : number, m23 : number, m24 : number, m30 : number, m31 : number, m32 : number, m33 : number, m34 : number )

Instance Methods

applySVGFilter( svgFilter : SVGFilterElement, inName : string, resultName? : string )

Appends filter sub-elements into the SVG filter element provided. Should include an in=${inName} for all inputs, and should either output using the resultName (or if not provided, the last element appended should be the output). This effectively mutates the provided filter object, and will be successively called on all Filters to build an SVG filter object.

applyCanvasFilter( wrapper : CanvasContextWrapper )

Given a specific canvas/context wrapper, this method should mutate its state so that the canvas now holds the filtered content. Usually this would be by using getImageData/putImageData, however redrawing or other operations are also possible.

isSVGCompatible() : boolean

isCanvasCompatible() : boolean

getCSSFilterString() : string

Source Code

See the source for ColorMatrixFilter.ts in the scenery repository.