Class RemoveColor

Remove white filter class

Example

const filter = new RemoveColor({
threshold: 0.2,
});
object.filters.push(filter);
object.applyFilters();
canvas.renderAll();

Hierarchy

Constructors

Properties

color: string

Color to remove, in any format understood by Color.

Param

Default


distance: number

distance to actual color, as value up or down from each r,g,b between 0 and 1

mainParameter?: keyof RemoveColor

Name of the parameter that can be changed in the filter. Some filters have more than one parameter and there is no mainParameter

useAlpha: boolean

For color to remove inside distance, use alpha channel for a smoother deletion NOT IMPLEMENTED YET

vertexSource: string = vertexSource

Array of attributes to send with buffers. do not modify

defaults: Partial<TClassProperties<RemoveColor>> = removeColorDefaultValues
type: string = 'RemoveColor'

The class type. Used to identify which class this is. This is used for serialization purposes and internally it can be used to identify classes. As a developer you could use instance of Class but to avoid importing all the code and blocking tree shaking we try to avoid doing that.

Accessors

Methods

  • Returns a string that represent the current selected shader code for the filter. Used to force recompilation when parameters change or to retrieve the shader from cache

    Returns string

  • Returns undefined | string | number | boolean | ((gl, program) => TWebGLAttributeLocationMap) | ((options) => TWebGLProgramCacheItem) | ((options?) => boolean) | (() => {
        color: string;
        distance: number;
        type: string;
    }) | (() => {
        type: string;
    }) | ((gl, program) => TWebGLUniformLocationMap) | ((gl, uniformLocations) => void) | (() => string) | ((options) => void) | ((canvasEl) => void) | ((gl, fragmentSource?, vertexSource?) => {
        attributeLocations: TWebGLAttributeLocationMap;
        program: WebGLProgram;
        uniformLocations: TWebGLUniformLocationMap;
    }) | ((gl, attributeLocations, aPositionData) => void) | ((options) => void) | ((options) => void) | ((options) => void) | ((gl, texture, textureUnit) => void) | ((gl, textureUnit) => void) | (() => undefined | string | number | boolean | ((gl, program) => TWebGLAttributeLocationMap) | ((options) => TWebGLProgramCacheItem) | ((options?) => boolean) | (() => {
        color: string;
        distance: number;
        type: string;
    }) | (() => {
        type: string;
    }) | ((gl, program) => TWebGLUniformLocationMap) | ((gl, uniformLocations) => void) | (() => string) | ((options) => void) | ((canvasEl) => void) | ((gl, fragmentSource?, vertexSource?) => {
        attributeLocations: TWebGLAttributeLocationMap;
        program: WebGLProgram;
        uniformLocations: TWebGLUniformLocationMap;
    }) | ((gl, attributeLocations, aPositionData) => void) | ((options) => void) | ((options) => void) | ((options) => void) | ((gl, texture, textureUnit) => void) | ((gl, textureUnit) => void) | (() => string | number | boolean | ((gl: WebGLRenderingContext, program: WebGLProgram) => TWebGLAttributeLocationMap) | ... 20 more ... | undefined) | ((value) => void) | ((options) => void) | (() => string)) | ((value) => void) | ((options) => void) | (() => string)

  • Generic isNeutral implementation for one parameter based filters. Used only in image applyFilters to discard filters that will not have an effect on the image Other filters may need their own version ( ColorMatrix, HueRotation, gamma, ComposedFilter )

    Parameters

    • Optional options: any

    Returns boolean

  • Send attribute data from this filter to its shader program on the GPU.

    Parameters

    • gl: WebGLRenderingContext

      The canvas context used to compile the shader program.

    • attributeLocations: Record<string, number>

      A map of shader attribute names to their locations.

    • aPositionData: Float32Array

    Returns void

  • Send data from this filter to its shader program's uniforms.

    Parameters

    • gl: WebGLRenderingContext

      The GL canvas context used to compile this filter's shader.

    • uniformLocations: TWebGLUniformLocationMap

      A map of string uniform names to WebGLUniformLocation objects

    Returns void

  • Returns object representation of an instance

    Returns {
        color: string;
        distance: number;
        type: string;
    }

    Object representation of an instance

    • color: string
    • distance: number
    • type: string

Generated using TypeDoc