Class BlendImage

Image Blend filter class

Example

const filter = new filters.BlendColor({
color: '#000',
mode: 'multiply'
});

const filter = new BlendImage({
image: fabricImageObject,
mode: 'multiply',
alpha: 0.5
});
object.filters.push(filter);
object.applyFilters();
canvas.renderAll();

Hierarchy

Constructors

Properties

alpha: number

alpha value. represent the strength of the blend image operation. not implemented.

Color to make the blend operation with. default to a reddish color since black or white gives always strong result.

mainParameter?: keyof BlendImage

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

mode: TBlendImageMode
vertexSource: string = vertexSource

Array of attributes to send with buffers. do not modify

defaults: Partial<TClassProperties<BlendImage>> = blendImageDefaultValues
type: string = 'BlendImage'

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

  • Calculate a transformMatrix to adapt the image to blend over

    Returns number[]

  • 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

  • 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

Generated using TypeDoc