new Brightness()
亮度滤光片类别
- Source:
- See:
-
- fabric.Image.filters.Brightness#initialize for constructor definition
- ImageFilters demo
Example
var filter = new fabric.Image.filters.Brightness({
brightness: 0.05
});
object.filters.push(filter);
object.applyFilters();
Extends
Members
brightness
亮度值,从-1到1。
2d转换为-255到255
0.0039215686是1在2d中转换成1的部分
- Source:
fragmentSource
片段源为亮度程序
- Source:
mainParameter
描述作为过滤器参数的属性
- Default Value:
- brightness
- Source:
type
过滤器类型
- Overrides:
- Default Value:
- Brightness
- Source:
Methods
applyTo(options)
将此过滤器应用于所提供的输入图像数据。
根据选项确定是使用WebGL还是Canvas2D。webgl国旗。
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | 剩余要执行的筛选器的数量是否使用webgl来渲染过滤器。纹理设置作为要过滤的源。应该绘制过滤输出的纹理。用于呈现的GL上下文。编译的着色器程序的映射,按过滤器类型键。 属性 名字 类型 描述 通过 数量 剩余要执行的筛选器的数量 webgl 布尔 是否使用webgl来渲染过滤器。 sourceTexture WebGLTexture 纹理设置作为要过滤的源。 targetTexture WebGLTexture 应该绘制过滤输出的纹理。 上下文 WebGLRenderingContext 用于呈现的GL上下文。 programCache 对象 编译的着色器程序的映射,按过滤器类型键。 |
- Inherited From:
- Source:
applyTo2d(options)
将亮度操作应用到Uint8ClampedArray上,表示图像的像素。
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | 要过滤的uint8clampearray。 属性 名字 类型 描述 imageData ImageData 要过滤的uint8clampearray。 |
- Source:
applyToWebGL(options)
使用webgl应用这个过滤器。
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | 剩余要执行的筛选器的数量是否使用webgl来渲染过滤器。原始输入图像的纹理。纹理设置作为要过滤的源。应该绘制过滤输出的纹理。用于呈现的GL上下文。编译的着色器程序的映射,按过滤器类型键。 属性 名字 类型 描述 通过 数量 剩余要执行的筛选器的数量 webgl 布尔 是否使用webgl来渲染过滤器。 originalTexture WebGLTexture 原始输入图像的纹理。 sourceTexture WebGLTexture 纹理设置作为要过滤的源。 targetTexture WebGLTexture 应该绘制过滤输出的纹理。 上下文 WebGLRenderingContext 用于呈现的GL上下文。 programCache 对象 编译的着色器程序的映射,按过滤器类型键。 |
- Inherited From:
- Source:
createHelpLayer()
如果2d过滤器需要,这个函数可以创建一个要使用的辅助画布
记住这些选项。targetCanvas可以使用,直到链结束。
- Inherited From:
- Source:
createProgram(gl, fragmentSource, vertexSource)
编译这个过滤器的着色器程序。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | 用于着色器编译的GL画布上下文。 |
fragmentSource |
String | fragmentShader编译源 |
vertexSource |
String | vertexShader编译源 |
- Inherited From:
- Source:
getAttributeLocations(gl, program) → {Object}
返回属性名映射到WebGLAttributeLocation对象。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | 用于编译着色器程序的画布上下文。 |
program |
WebGLShaderProgram | 着色器程序,从中获取属性位置。 |
- Inherited From:
- Source:
Returns:
A map of attribute names to attribute locations.
- Type
- Object
getUniformLocations(gl, program)
返回这个过滤器的着色器的WebGL统一位置。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | GL画布上下文用于编译这个过滤器的着色器。 |
program |
WebGLShaderProgram | 这个过滤器的编译着色程序。 |
- Overrides:
- Source:
initialize(optionsopt)
构造函数
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
选择对象 |
- Inherited From:
- Source:
isNeutralState(options)
基于一个参数的过滤器的通用isNeutral实现。
仅在image applyFilters中使用,用于丢弃不起作用的过滤器
在图像上
其他滤镜可能需要自己的版本(ColorMatrix, HueRotation, gamma, ComposedFilter)
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Inherited From:
- Source:
retrieveShader(options)
检索缓存的着色器。
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | 用于呈现的GL上下文。编译的着色器程序的映射,按过滤器类型键。 属性 名字 类型 描述 上下文 WebGLRenderingContext 用于呈现的GL上下文。 programCache 对象 编译的着色器程序的映射,按过滤器类型键。 |
- Inherited From:
- Source:
sendAttributeData(gl, attributeLocations)
将属性数据从这个过滤器发送到它在GPU上的着色程序。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | 用于编译着色器程序的画布上下文。 |
attributeLocations |
Object | 着色器属性名称到其位置的映射。 |
- Inherited From:
- Source:
sendUniformData(gl, uniformLocations)
从这个过滤器发送数据到它的着色程序的制服。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | GL画布上下文用于编译这个过滤器的着色器。 |
uniformLocations |
Object | 字符串统一名称到WebGLUniformLocation对象的映射 |
- Overrides:
- Source:
setOptions(optionsopt)
从选项中设置过滤器的属性
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
选择对象 |
- Inherited From:
- Source:
toObject() → {Object}
返回实例的对象表示形式
- Inherited From:
- Source:
Returns:
Object representation of an instance
- Type
- Object