<?xml version="1.0" encoding="utf-8"?>
<!--
/*****************************************************************************
 *
 * 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.
 *
 *****************************************************************************/
-->
<graph name = "CombineTwoInputs" xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">

    <metadata name = "namespace" value = "AIF" />
    <metadata name = "vendor" value = "Adobe" />
    <metadata name = "version" type = "int" value = "1" />
    <metadata name = "clientID" value = "ADBE Combine" />


    <!-- Parameters to the graph -->
    // An input parameter used to specify the weight of each input image to the output.
    <parameter type = "float" name = "weight" >
         <metadata name = "defaultValue" type = "float" value = "0.5" />
         <metadata name = "minValue" type = "float" value = "0.0" />
         <metadata name = "maxValue" type = "float" value = "1.0" />
    </parameter>


    <!-- Image inputs and outputs of the graph -->
    <inputImage  type = "image4" name = "src1" />
    <inputImage  type = "image4" name = "src2" />
    <outputImage type = "image4" name = "dst" />


    <!-- Embedded kernel -->
    <kernel>
        <![CDATA[
            <languageVersion : 1.0;>
                kernel Combine
                <
                    namespace : "AIF";
                    vendor : "Adobe";
                    version : 1;
                    clientID : "ADBE Combine";
                >
                {
                    parameter float weight;
                    input  image4 src1;
                    input  image4 src2;
                    output pixel4 dst;

                    void
                    evaluatePixel()
                    {
                        dst = weight*sampleNearest(src1, outCoord()) + (1.0 - weight)*sampleNearest(src2, outCoord());
                    }
                }
        ]]>
    </kernel>


    <!-- Instances of the nodes -->
    <node id = "combineFilter" name = "Combine" vendor="Adobe" namespace="AIF" version="1" clientID ="ADBE Combine">
     <evaluateParameters>
         <![CDATA[
         void evaluateParameters()
         {
            combineFilter::weight = weight;
         } 
         ]]>
     </evaluateParameters>
    </node>

    <!-- Connect the graph -->
    <connect fromImage = "src1" toNode = "combineFilter" toInput = "src1" />
    <connect fromImage = "src2" toNode = "combineFilter" toInput = "src2" /> />
    <connect fromNode = "combineFilter" fromOutput = "dst" toImage = "dst" />

</graph>

