TwoTerm/ScanLineFilter.cikernel
Kelvin Sherlock ce666ed1ba updated ScanLine Filter
git-svn-id: svn://qnap.local/TwoTerm/trunk@2012 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
2011-02-03 02:37:12 +00:00

25 lines
465 B
Plaintext

/*
* simulate scanlines by darkening every other line.
*
*/
kernel vec4 scanline(sampler image, float l, float d)
{
vec4 light, dark;
vec2 coord = samplerCoord(image);
vec4 pixel = sample(image, coord);
pixel = unpremultiply(pixel);
light = dark = pixel;
dark.rgb = pixel.rgb * (1.0 - d);
light.rgb = pixel.rgb * (1.0 - l) + l;
pixel.rgb = mod(coord.y, 2.0) < 1.0 ? light.rgb : dark.rgb;
return premultiply(pixel);
}