<languageVersion : 1.0;>

kernel omino_staragon_32
<   displayName : "omino staragon 32";
    category : "omino";
    namespace : "omino";
    vendor : "omino";
    version : 1;
    description : "draw or stroke regular polygons";
>
{
    input image4 src;
    output pixel4 dst;
    
    parameter float4 color1
    <
        aeUIControl:"aeColor";
        minValue:float4(0,0,0,0);
        maxValue:float4(1,1,1,1);
        defaultValue:float4(1,0,.3,1);
    >;
    void
    evaluatePixel()
    {
        // Start with the current point,
        // with coordinates relative to the
        // center of the polygon.
        float2 coord = outCoord();
        coord -= center;
        
        float4 imagePixel = sampleNearest(src,outCoord());
        // The content to use for what's in the polygon, and what's outside.
        float4 pIn = drawn == 1 ? imagePixel : color1;
        float4 pOut = undrawn == 1 ? imagePixel : color2;
        
        if(drawn == 2) // drawn area is "nothing"? make it the undrawn area no alpha
        {
            pIn = pOut;
            pIn.a = 0.0;
        }
        if(undrawn == 2) // undrawn area is "nothing"? make it the drawn area no alpha
        {
            pOut = pIn;
            pOut.a = 0.0;
        }
                
    }
}