/*
 * 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);
}
