new HueRotation()
HueRotation filter class
hueroation过滤器类
- Source:
- See:
-
- fabric.Image.filters.HueRotation#initialize for constructor definition
- ImageFilters demo
Example
var filter = new fabric.Image.filters.HueRotation({
rotation: -0.5
});
object.filters.push(filter);
object.applyFilters();
Extends
Members
mainParameter
Describe the property that is the filter parameter
描述作为过滤器参数的属性
- Default Value:
- rotation
- Source:
rotation
HueRotation value, from -1 to 1.
the unit is radians
旋转值,从-1到1。
单位是弧度
- Source:
type
Filter type
过滤器类型
- Overrides:
- Default Value:
- HueRotation
- Source:
Methods
applyTo(options)
Apply this filter to the input image data provided.
Determines whether to use WebGL or Canvas2D based on the options.webgl flag.
将此过滤器应用于所提供的输入图像数据。
根据选项确定是使用WebGL还是Canvas2D。webgl国旗。
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Overrides:
- Source:
applyToWebGL(options)
Apply this filter using webgl.
使用webgl应用这个过滤器。
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Inherited From:
- Source:
createHelpLayer()
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.
如果2d过滤器需要,这个函数可以创建一个要使用的辅助画布
记住这些选项。targetCanvas可以使用,直到链结束。
- Inherited From:
- Source:
createProgram(gl, fragmentSource, vertexSource)
Compile this filter's shader program.
编译这个过滤器的着色器程序。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The GL canvas context to use for shader compilation.用于着色器编译的GL画布上下文。 |
fragmentSource |
String | fragmentShader source for compilationfragmentShader编译源 |
vertexSource |
String | vertexShader source for compilationvertexShader编译源 |
- Inherited From:
- Source:
getAttributeLocations(gl, program) → {Object}
Return a map of attribute names to WebGLAttributeLocation objects.
返回属性名映射到WebGLAttributeLocation对象。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The canvas context used to compile the shader program.用于编译着色器程序的画布上下文。 |
program |
WebGLShaderProgram | The shader program from which to take attribute locations.着色器程序,从中获取属性位置。 |
- Inherited From:
- Source:
Returns:
A map of attribute names to attribute locations.
- Type
- Object
getUniformLocations(gl, program) → {Object}
Return a map of uniform names to WebGLUniformLocation objects.
Intended to be overridden by subclasses.
返回WebGLUniformLocation对象的统一名称映射。
打算被子类覆盖。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The canvas context used to compile the shader program.用于编译着色器程序的画布上下文。 |
program |
WebGLShaderProgram | The shader program from which to take uniform locations.着色器程序从中获取统一的位置。 |
- Inherited From:
- Source:
Returns:
A map of uniform names to uniform locations.
- Type
- Object
initialize(optionsopt)
Constructor
构造函数
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
Options object选择对象 |
- Inherited From:
- Source:
isNeutralState(options)
HueRotation isNeutralState implementation
Used only in image applyFilters to discard filters that will not have an effect
on the image
hueroation isNeutralState实现
仅在image applyFilters中使用,用于丢弃不起作用的过滤器
在图像上
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Overrides:
- Source:
retrieveShader(options)
Retrieves the cached shader.
检索缓存的着色器。
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Inherited From:
- Source:
sendAttributeData(gl, attributeLocations)
Send attribute data from this filter to its shader program on the GPU.
将属性数据从这个过滤器发送到它在GPU上的着色程序。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The canvas context used to compile the shader program.用于编译着色器程序的画布上下文。 |
attributeLocations |
Object | A map of shader attribute names to their locations.着色器属性名称到其位置的映射。 |
- Inherited From:
- Source:
sendUniformData(gl, uniformLocations)
Send uniform data from this filter to its shader program on the GPU.
Intended to be overridden by subclasses.
从这个过滤器发送统一的数据到它在GPU上的着色程序。
打算被子类覆盖。
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The canvas context used to compile the shader program.用于编译着色器程序的画布上下文。 |
uniformLocations |
Object | A map of shader uniform names to their locations.一个着色器统一名称到其位置的地图。 |
- Inherited From:
- 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
返回实例的JSON表示形式
- Inherited From:
- Source:
Returns:
JSON
- Type
- Object
toObject() → {Object}
Returns object representation of an instance
返回实例的对象表示形式
- Inherited From:
- Source:
Returns:
Object representation of an instance
- Type
- Object