What is the best way to hide specific (interpolated) color ranges? For example, I have a gradient that goes from blue > cyan > yellow > red. What I need is to hide blue > cyan, yellow > red but leave the cyan > yellow.
var rangeA:Object = {min:0x0000FF, max:0x00FFFF} //hide
var rangeB:Object = {min:0x00FFFF, max:0xFFFF00}; //show
var rangeC:Object = {min:0xFFFF00, max:0xFF0000}; //hide
It is ok to apply different filter for each range.
Any ideas?
This is the simplest solution i've found:
void
evaluatePixel()
{
float4 color = sampleNearest(src,outCoord());
float maxR = max(minColor.r, maxColor.r);
float maxG = max(minColor.g, maxColor.g);
float maxB = max(minColor.b, maxColor.b);
float minR = min(minColor.r, maxColor.r);
float minG = min(minColor.g, maxColor.g);
float minB = min(minColor.b, maxColor.b);
dst = color;
// Check whether a color is within the range
if(color.r >= minR && color.g >= minG && color.b >= minB)
{
if(color.r <= maxR && color.g <= maxG && color.b <= maxB)
{
dst = float4(0.0,0.0,0.0,0.0);
}
}
}