| invert_explicitly.cxx |  | 
Invert an image file (create a negative) by coding the loop explicitly 
 Usage: example_invert_explicitly infile outfile
                
 
#include <iostream>
#include "vigra/stdimage.hxx"
#include "vigra/stdimagefunctions.hxx"
using namespace vigra; 
int main(int argc, char ** argv)
{
    if(argc != 3)
    {
        std::cout << "Usage: " << argv[0] << " infile outfile" << std::endl;
        
        return 1;
    }
    
    try
    {
        
        {
           
            
            
            
            
            
            
            
            
            
            
            
            for(; sy.
y != send.y; ++sy.y, ++dy.y)
 
            {
                
                
                
                
                
                
                for(; sx.
x != send.x; ++sx.x, ++dx.x)
 
                {
                    
                    *dx = 255 - *sx;
                }
            }
            
        }
        else
        {
           
            
            
            
            
            
            
            
            
            
            
            
            
            for(; sy.y != send.y; ++sy.y, ++dy.y)
            {
                
                
                
                
                
                
                for(; sx.x != send.x; ++sx.x, ++dx.x)
                {
                    
                    *dx = offset - *sx;
                }
            }
            
        }
    }
    catch (vigra::StdException & e)
    {
        std::cout << e.what() << std::endl;
        return 1;
    }
    
    return 0;
}