Constructor
new ColorFilter(matopt)
Create a
ColorFilter
Example。
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mat |
Array
|
<optional> |
null | mat (optional) an array of 20 items (arranged in 4 x 5 matrices) used for color conversion. |
Extends
Methods
adjustBrightness(brightness) → {ColorFilter}
adjust brightness
Parameters:
Name | Type | Description |
---|---|---|
brightness |
Number
|
Brightness range: -100~100 |
adjustColor(brightness, contrast, saturation, hue) → {ColorFilter}
Adjust colors, including brightness, contrast, saturation, and hue
Parameters:
Name | Type | Description |
---|---|---|
brightness |
Number
|
Brightness range: -100~100 |
contrast |
Number
|
Contrast range: -100~100 |
saturation |
Number
|
Saturation range: -100~100 |
hue |
Number
|
Range of colors: -180~180 |
adjustContrast(contrast) → {ColorFilter}
Adjust contrast
Parameters:
Name | Type | Description |
---|---|---|
contrast |
Number
|
Contrast range: -100~100 |
adjustHue(hue) → {ColorFilter}
Toning
Parameters:
Name | Type | Description |
---|---|---|
hue |
Number
|
Range of colors: -180~180 |
adjustSaturation(saturation) → {ColorFilter}
desaturate
Parameters:
Name | Type | Description |
---|---|---|
saturation |
Number
|
Saturation range: -100~100 |
color(redopt, greenopt, blueopt, alphaopt)
Set to color filter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
red |
Number
|
<optional> |
0 | red Red increment, range: 0~255 |
green |
Number
|
<optional> |
0 | green Green increment, range: 0~255 |
blue |
Number
|
<optional> |
0 | blue Blue increment, range: 0~255 |
alpha |
Number
|
<optional> |
1 | alpha Alpha, range: 0~1 |
gray()
Set to gray filter
reset()
Reset to unit matrix to remove filter effect
setByMatrix(matrix) → {ColorFilter}
Set matrix data
Parameters:
Name | Type | Description |
---|---|---|
matrix |
Array
|
An array consisting of 20 items (arranged in 4 x 5 matrices) |