This source file includes following definitions.
- colorkey_blend
- colorkey
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE |
CLK_FILTER_NEAREST;
__kernel void colorkey_blend(
__read_only image2d_t src,
__write_only image2d_t dst,
float4 colorkey_rgba,
float similarity,
float blend
) {
int2 loc = (int2)(get_global_id(0), get_global_id(1));
float4 pixel = read_imagef(src, sampler, loc);
float diff = distance(pixel.xyz, colorkey_rgba.xyz);
pixel.s3 = clamp((diff - similarity) / blend, 0.0f, 1.0f);
write_imagef(dst, loc, pixel);
}
__kernel void colorkey(
__read_only image2d_t src,
__write_only image2d_t dst,
float4 colorkey_rgba,
float similarity
) {
int2 loc = (int2)(get_global_id(0), get_global_id(1));
float4 pixel = read_imagef(src, sampler, loc);
float diff = distance(pixel.xyz, colorkey_rgba.xyz);
pixel.s3 = (diff > similarity) ? 1.0f : 0.0f;
write_imagef(dst, loc, pixel);
}