/*****************************************************************************
 *
 * Copyright (C) 2008 Adobe Systems Incorporated
 * All Rights Reserved.
 *
 * NOTICE:  All information contained  herein is,  and remains the property of
 * Adobe Systems Incorporated and its suppliers, if any.  The intellectual and
 * technical  concepts  contained  herein  are  proprietary  to  Adobe Systems
 * Incorporated  and  its suppliers  and may  be covered  by U.S.  and Foreign
 * Patents, patents in process, and are protected by trade secret or copyright
 * law.  Dissemination of this information or reproduction of this material is
 * strictly forbidden  unless prior  written permission is obtained from Adobe
 * Systems Incorporated.
 *
 *****************************************************************************/

<languageVersion: 1.0;>
 
// InvertRGB: A simple example to demonstrate how to invert the RGB color 
//            space.
kernel InvertRGB
<   namespace : "AIF";
    vendor : "Adobe Systems, Inc.";
    version : 2;
    description : "Invert the Red, Green and Blue channels of an image"; >
{
    input image4 src;
    output float4 dst;
    
    // evaluatePixel(): The function of the kernel that actually does the 
    //                  processing of the image.  This function is called once 
    //                  for each pixel of the output image.
    void
    evaluatePixel()
    {
        // Obtain the input pixel color
        float4 inputColor = sampleNearest(src, outCoord());

        // Calculate (1 - channel) for each of the RGB channels
        dst.rgb = float3(1.0, 1.0, 1.0) - inputColor.rgb;
        
        // set the alpha value equal to the alpha of the input
        dst.a = inputColor.a;
    }
}

