topical media & game development

talk show tell print

graphic-shader-invertRGB.pbk / pbk



  
*************************************************************************** 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 filter 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;
      }
  }
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.