Blame IlmImf/ImfCompositeDeepScanLine.h

Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
//
Packit 0d464f
// Copyright (c) 2012, Weta Digital Ltd
Packit 0d464f
// 
Packit 0d464f
// All rights reserved.
Packit 0d464f
// 
Packit 0d464f
// Redistribution and use in source and binary forms, with or without
Packit 0d464f
// modification, are permitted provided that the following conditions are
Packit 0d464f
// met:
Packit 0d464f
// *       Redistributions of source code must retain the above copyright
Packit 0d464f
// notice, this list of conditions and the following disclaimer.
Packit 0d464f
// *       Redistributions in binary form must reproduce the above
Packit 0d464f
// copyright notice, this list of conditions and the following disclaimer
Packit 0d464f
// in the documentation and/or other materials provided with the
Packit 0d464f
// distribution.
Packit 0d464f
// *       Neither the name of Weta Digital nor the names of
Packit 0d464f
// its contributors may be used to endorse or promote products derived
Packit 0d464f
// from this software without specific prior written permission. 
Packit 0d464f
// 
Packit 0d464f
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 0d464f
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 0d464f
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 0d464f
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 0d464f
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 0d464f
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 0d464f
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 0d464f
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 0d464f
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 0d464f
//
Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
Packit 0d464f
Packit 0d464f
#ifndef INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
Packit 0d464f
#define INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
Packit 0d464f
Packit 0d464f
//-----------------------------------------------------------------------------
Packit 0d464f
//
Packit 0d464f
//	Class to composite deep samples into a frame buffer
Packit 0d464f
//      Initialise with a deep input part or deep inputfile
Packit 0d464f
//      (also supports multiple files and parts, and will 
Packit 0d464f
//       composite them together, as long as their sizes and channelmaps agree)
Packit 0d464f
//       
Packit 0d464f
//      Then call setFrameBuffer, and readPixels, exactly as for reading 
Packit 0d464f
//      regular scanline images.
Packit 0d464f
//
Packit 0d464f
//      Restrictions - source file(s) must contain at least Z and alpha channels
Packit 0d464f
//                   - if multiple files/parts are provided, sizes must match
Packit 0d464f
//                   - all requested channels will be composited as premultiplied
Packit 0d464f
//                   - only half and float channels can be requested
Packit 0d464f
//
Packit 0d464f
//      This object should not be considered threadsafe
Packit 0d464f
//  
Packit 0d464f
//      The default compositing engine will give spurious results with overlapping
Packit 0d464f
//      volumetric samples - you may derive from DeepCompositing class, override the 
Packit 0d464f
//      sort_pixel() and composite_pixel() functions, and pass an instance to 
Packit 0d464f
//      setCompositing(). 
Packit 0d464f
//
Packit 0d464f
//-----------------------------------------------------------------------------
Packit 0d464f
Packit 0d464f
#include "ImfForward.h"
Packit 0d464f
#include "ImfNamespace.h"
Packit 0d464f
#include "ImfExport.h"
Packit 0d464f
#include <ImathBox.h>
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit 0d464f
Packit 0d464f
class IMF_EXPORT CompositeDeepScanLine
Packit 0d464f
{
Packit 0d464f
    public:
Packit 0d464f
        CompositeDeepScanLine();
Packit 0d464f
       virtual ~CompositeDeepScanLine();
Packit 0d464f
        
Packit 0d464f
        /// set the source data as a part
Packit 0d464f
        ///@note all parts must remain valid until after last interaction with DeepComp
Packit 0d464f
        void addSource(DeepScanLineInputPart * part);
Packit 0d464f
        
Packit 0d464f
        /// set the source data as a file
Packit 0d464f
        ///@note all file must remain valid until after last interaction with DeepComp
Packit 0d464f
        void addSource(DeepScanLineInputFile * file);
Packit 0d464f
        
Packit 0d464f
        
Packit 0d464f
        /////////////////////////////////////////
Packit 0d464f
        //
Packit 0d464f
        // set the frame buffer for output values
Packit 0d464f
        // the buffers specified must be large enough
Packit 0d464f
        // to handle the dataWindow() 
Packit 0d464f
        //
Packit 0d464f
        /////////////////////////////////////////
Packit 0d464f
        void setFrameBuffer(const FrameBuffer & fr);
Packit 0d464f
        
Packit 0d464f
        
Packit 0d464f
        
Packit 0d464f
        /////////////////////////////////////////
Packit 0d464f
        //
Packit 0d464f
        // retrieve frameBuffer
Packit 0d464f
        //
Packit 0d464f
        ////////////////////////////////////////
Packit 0d464f
        const FrameBuffer & frameBuffer() const;
Packit 0d464f
        
Packit 0d464f
        
Packit 0d464f
        //////////////////////////////////////////////////
Packit 0d464f
        //
Packit 0d464f
        // read scanlines start to end from the source(s)
Packit 0d464f
        // storing the result in the frame buffer provided
Packit 0d464f
        //
Packit 0d464f
        //////////////////////////////////////////////////
Packit 0d464f
        
Packit 0d464f
        void readPixels(int start,int end);
Packit 0d464f
        
Packit 0d464f
        int sources() const; // return number of sources
Packit 0d464f
        
Packit 0d464f
        /////////////////////////////////////////////////
Packit 0d464f
        //
Packit 0d464f
        // retrieve the datawindow
Packit 0d464f
        // If multiple parts are specified, this will
Packit 0d464f
        // be the union of the dataWindow of all parts
Packit 0d464f
        //
Packit 0d464f
        ////////////////////////////////////////////////
Packit 0d464f
        
Packit 0d464f
        const IMATH_NAMESPACE::Box2i & dataWindow() const;
Packit 0d464f
        
Packit 0d464f
 
Packit 0d464f
        //
Packit 0d464f
        // override default sorting/compositing operation
Packit 0d464f
        // (otherwise an instance of the base class will be used)
Packit 0d464f
        //
Packit 0d464f
        
Packit 0d464f
        void setCompositing(DeepCompositing *);
Packit 0d464f
        
Packit 0d464f
      struct Data; 
Packit 0d464f
    private :  
Packit 0d464f
      struct Data *_Data;
Packit 0d464f
      
Packit 0d464f
      CompositeDeepScanLine(const CompositeDeepScanLine &); // not implemented
Packit 0d464f
      const CompositeDeepScanLine & operator=(const CompositeDeepScanLine &);  // not implemented
Packit 0d464f
};
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit 0d464f
Packit 0d464f
#endif