I'm trying to additively blend the edges of an image with a Pixel Bender shader but I can't quite figure out how to detect the edge itself. I've tried this but it's not working:
{
input image4 src;
output pixel4 dst;
void
evaluatePixel()
{
if(outCoord().x == 0.0)
{
dst = sampleNearest(src, outCoord());
dst.rgb = float3(255.0, 255.0, 255.0); // just a test to see if the left side will turn white
}
else
{
dst = sampleNearest(src, outCoord());
}
}
}
I'm not sure how to go about detecting the width and height of the image either.
I'm trying to make the image "glow" around the edges by additively blending the first few pixels together. x:0 would be 1-4 blended, 2 would be 2-4 blending, 3 would be 3-4 blended type of thing.
Some guidance?
I think only way to pass width and height as shader parameters from as3...