Skip to content

是否可以添加自定义滤镜定义途径? #1

@huzunjie

Description

@huzunjie

比如在sprite上约定一个自定义滤镜函数的属性(比如 customFilter(r, g, b, a, imageData)=>{ ... 这里是滤镜处理过程... } ),这样就可以在drawImage后针对贴图进行像素处理:

const imgRect = cvs.getImageData(...rect);
const imgData = imgRect.data;
for(var i=0; i<imgData.length; i+=4){
  customFilter(imgData[i], imgData[i+1], imgData[i+2], imgData[i+3], imgData, imgRect);
}
cvs.putImageData(imgRect,...rect)

负面影响:缓存策略需要考虑修改,避免出错。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions