1 Reply Latest reply on Feb 24, 2010 11:16 AM by Kevin Goldsmith

    I'm trying to blend in a negative

    nikos101 Level 2

      I'm trying to blend in a negative with a normal image but am getting errors

       


      <languageVersion : 1.0;>

       

      kernel Crossfade
      <   namespace : "AIF";
          vendor : "Adobe Systems";
          version : 2;
          description : "Miz in inversion"; >
      {
         parameter float intensity;

       

         input image4 src;
         output pixel4 dst;
        
         void evaluatePixel()
         {
             float4 src=  sampleNearest(src, outCoord());
             float4 sr2=  sampleNearest(src, outCoord());
         
             src2.rgb=  float3(1.0, 1.0, 1.0) - src.rgb;
             
           
              dst = mix(src,src2, intensity);
         }
      }

       

      ERROR: (line 18): 'sampleNearest' : no matching overloaded function found

       

      ERROR: (line 18): '=' :  cannot convert from 'const float' to '4-component vector of float'

       

      ERROR: (line 20): 'src2' : undeclared identifier

       

      ERROR: (line 20): 'rgb' :  field selection requires structure, vector, or matrix on left hand side

       

      ERROR: (line 20): 'assign' :  cannot convert from '3-component vector of float' to 'float'

       

      ERROR: (line 23): 'mix' : no matching overloaded function found

       

      ERROR: (line 23): 'assign' :  cannot convert from 'const float' to 'output 4-component vector of float'

        • 1. Re: I'm trying to blend in a negative
          Kevin Goldsmith Level 3

          It looks like you modified the crossfade sample, but add a syntax error.

           

          I made two changes (rename variable "sr2" to be "src2" and not bother sampling the same pixel twice) and this seems to work fine:

           

          kernel Crossfade
          <   namespace : "AIF";
              vendor : "Adobe Systems";
              version : 2;
              description : "Miz in inversion"; >
          {
             parameter float intensity;

           

             input image4 src;
             output pixel4 dst;
           
             void evaluatePixel()
             {
                 float4 src=  sampleNearest(src, outCoord());
                 float4 src2= src;
            
                 src2.rgb=  float3(1.0, 1.0, 1.0) - src.rgb;
                
              
                  dst = mix(src,src2, intensity);
             }
          }