Class: Tint

fabric.Image.filters.Tint

new Tint()

Tint filter class Adapted from https://github.com/mezzoblue/PaintbrushJS
Source:
See:
Examples

Tint filter with hex color and opacity

var filter = new fabric.Image.filters.Tint({
  color: '#3513B0',
  opacity: 0.5
});
object.filters.push(filter);
object.applyFilters(canvas.renderAll.bind(canvas));

Tint filter with rgba color

var filter = new fabric.Image.filters.Tint({
  color: 'rgba(53, 21, 176, 0.5)'
});
object.filters.push(filter);
object.applyFilters(canvas.renderAll.bind(canvas));

Extends

Members

type

Filter type
Overrides:
Default Value:
  • Tint
Source:

Methods

applyTo(canvasEl)

Applies filter to canvas element
Parameters:
Name Type Description
canvasEl Object Canvas element to apply filter to
Source:

initialize(optionsopt)

Constructor
Parameters:
Name Type Attributes Description
options Object <optional>
Options object
Properties
Name Type Attributes Default Description
color String <optional>
#000000 Color to tint the image with
opacity Number <optional>
Opacity value that controls the tint effect's transparency (0..1)
Overrides:
Source:

setOptions(optionsopt)

Sets filter's properties from options
Parameters:
Name Type Attributes Description
options Object <optional>
Options object
Inherited From:
Source:

toJSON() → {Object}

Returns a JSON representation of an instance
Inherited From:
Source:
Returns:
JSON
Type
Object

toObject() → {Object}

Returns object representation of an instance
Overrides:
Source:
Returns:
Object representation of an instance
Type
Object