Class BaseFilter

Hierarchy

Constructors

Properties

mainParameter?: keyof BaseFilter

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

vertexSource: string = vertexSource

Array of attributes to send with buffers. do not modify

defaults: Record<string, any>
type: string = 'BaseFilter'

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

  • Parameters

    • gl: WebGLRenderingContext
    • texture: WebGLTexture
    • textureUnit: number

    Returns void

  • If needed by a 2d filter, this functions can create an helper canvas to be used remember that options.targetCanvas is available for use till end of chain.

    Parameters

    Returns void

  • Return a map of attribute names to WebGLAttributeLocation objects.

    Parameters

    • gl: WebGLRenderingContext

      The canvas context used to compile the shader program.

    • program: WebGLProgram

      The shader program from which to take attribute locations.

    Returns TWebGLAttributeLocationMap

    A map of attribute names to attribute locations.

  • 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 | ((options) => void) | ((gl, program) => TWebGLUniformLocationMap) | ((gl, program) => TWebGLAttributeLocationMap) | ((gl, uniformLocations) => void) | ((options) => void) | ((options) => TWebGLProgramCacheItem) | ((options?) => boolean) | ((gl, fragmentSource?, vertexSource?) => {
        attributeLocations: TWebGLAttributeLocationMap;
        program: WebGLProgram;
        uniformLocations: TWebGLUniformLocationMap;
    }) | ((gl, attributeLocations, aPositionData) => void) | ((options) => void) | ((options) => void) | (() => string) | ((options) => void) | ((gl, texture, textureUnit) => void) | ((gl, textureUnit) => void) | (() => undefined | string | ((options) => void) | ((gl, program) => TWebGLUniformLocationMap) | ((gl, program) => TWebGLAttributeLocationMap) | ((gl, uniformLocations) => void) | ((options) => void) | ((options) => TWebGLProgramCacheItem) | ((options?) => boolean) | ((gl, fragmentSource?, vertexSource?) => {
        attributeLocations: TWebGLAttributeLocationMap;
        program: WebGLProgram;
        uniformLocations: TWebGLUniformLocationMap;
    }) | ((gl, attributeLocations, aPositionData) => void) | ((options) => void) | ((options) => void) | (() => string) | ((options) => void) | ((gl, texture, textureUnit) => void) | ((gl, textureUnit) => void) | (() => string | ((options: TWebGLPipelineState | T2DPipelineState) => void) | ((gl: WebGLRenderingContext, program: WebGLProgram) => TWebGLUniformLocationMap) | ... 18 more ... | undefined) | (() => {
        type: string;
    }) | (() => {
        type: string;
    }) | ((value) => void) | ((options) => void)) | (() => {
        type: string;
    }) | (() => {
        type: string;
    }) | ((value) => void) | ((options) => void)

  • Return a map of uniform names to WebGLUniformLocation objects.

    Intended to be overridden by subclasses.

    Parameters

    • gl: WebGLRenderingContext

      The canvas context used to compile the shader program.

    • program: WebGLProgram

      The shader program from which to take uniform locations.

    Returns TWebGLUniformLocationMap

    A map of uniform names to uniform locations.

  • 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 uniform data from this filter to its shader program on the GPU.

    Intended to be overridden by subclasses.

    Parameters

    • gl: WebGLRenderingContext

      The canvas context used to compile the shader program.

    • uniformLocations: TWebGLUniformLocationMap

      A map of shader uniform names to their locations.

    Returns void

  • Returns a JSON representation of an instance

    Returns {
        type: string;
    }

    JSON

    • type: string
  • Returns object representation of an instance

    Returns {
        type: string;
    }

    Object representation of an instance

    • type: string
  • Parameters

    • gl: WebGLRenderingContext
    • textureUnit: number

    Returns void

Generated using TypeDoc