我正在使用 AIR + AS3 编写一个 android 应用程序。由于 GPU 模式不支持像素弯曲文件,我正在尝试将此色度键过滤器转换为纯 AS3。任何建议、工具或帮助将不胜感激:
<languageVersion : 1.0;>
kernel DifferenceKey
< namespace : "com.quasimondo";
vendor : "Quasimondo";
version : 1;
description : "A simple difference key for chroma keying";
>
{
input image4 src;
output pixel4 dst;
parameter float3 keyColor;
parameter float tolerance
<
minValue: 0.0;
maxValue: 3.0;
defaultValue: 0.02;
>;
parameter float ramp
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 0.005;
>;
parameter float gamma
<
minValue: 0.0;
maxValue: 10.0;
defaultValue: 1.00;
>;
void
evaluatePixel()
{
dst = sampleNearest(src,outCoord());
float diff = length( dst.rgb - keyColor );
if ( diff < tolerance )
{
dst.a = 0.0;
} else if ( diff < tolerance + ramp )
{
dst.a = pow( (diff - tolerance) / ramp, gamma );
}
}
}