HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ImfCompositeDeepScanLine.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2012, Weta Digital Ltd
4 //
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are
9 // met:
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Weta Digital nor the names of
17 // its contributors may be used to endorse or promote products derived
18 // from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //
32 ///////////////////////////////////////////////////////////////////////////
33 
34 
35 #ifndef INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
36 #define INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
37 
38 //-----------------------------------------------------------------------------
39 //
40 // Class to composite deep samples into a frame buffer
41 // Initialise with a deep input part or deep inputfile
42 // (also supports multiple files and parts, and will
43 // composite them together, as long as their sizes and channelmaps agree)
44 //
45 // Then call setFrameBuffer, and readPixels, exactly as for reading
46 // regular scanline images.
47 //
48 // Restrictions - source file(s) must contain at least Z and alpha channels
49 // - if multiple files/parts are provided, sizes must match
50 // - all requested channels will be composited as premultiplied
51 // - only half and float channels can be requested
52 //
53 // This object should not be considered threadsafe
54 //
55 // The default compositing engine will give spurious results with overlapping
56 // volumetric samples - you may derive from DeepCompositing class, override the
57 // sort_pixel() and composite_pixel() functions, and pass an instance to
58 // setCompositing().
59 //
60 //-----------------------------------------------------------------------------
61 
62 #include "ImfForward.h"
63 #include "ImfNamespace.h"
64 #include "ImfExport.h"
65 #include "ImathBox.h"
66 
68 
70 {
71  public:
73  virtual ~CompositeDeepScanLine();
74 
75  /// set the source data as a part
76  ///@note all parts must remain valid until after last interaction with DeepComp
77  void addSource(DeepScanLineInputPart * part);
78 
79  /// set the source data as a file
80  ///@note all file must remain valid until after last interaction with DeepComp
81  void addSource(DeepScanLineInputFile * file);
82 
83 
84  /////////////////////////////////////////
85  //
86  // set the frame buffer for output values
87  // the buffers specified must be large enough
88  // to handle the dataWindow()
89  //
90  /////////////////////////////////////////
91  void setFrameBuffer(const FrameBuffer & fr);
92 
93 
94 
95  /////////////////////////////////////////
96  //
97  // retrieve frameBuffer
98  //
99  ////////////////////////////////////////
100  const FrameBuffer & frameBuffer() const;
101 
102 
103  //////////////////////////////////////////////////
104  //
105  // read scanlines start to end from the source(s)
106  // storing the result in the frame buffer provided
107  //
108  //////////////////////////////////////////////////
109 
110  void readPixels(int start,int end);
111 
112  int sources() const; // return number of sources
113 
114  /////////////////////////////////////////////////
115  //
116  // retrieve the datawindow
117  // If multiple parts are specified, this will
118  // be the union of the dataWindow of all parts
119  //
120  ////////////////////////////////////////////////
121 
122  const IMATH_NAMESPACE::Box2i & dataWindow() const;
123 
124 
125  //
126  // override default sorting/compositing operation
127  // (otherwise an instance of the base class will be used)
128  //
129 
130  void setCompositing(DeepCompositing *);
131 
132  struct Data;
133  private :
134  struct Data *_Data;
135 
136  CompositeDeepScanLine(const CompositeDeepScanLine &); // not implemented
137  const CompositeDeepScanLine & operator=(const CompositeDeepScanLine &); // not implemented
138 };
139 
141 
142 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
GLuint start
Definition: glcorearb.h:474
GLsizei GLenum * sources
Definition: glcorearb.h:2541
Box< V2i > Box2i
Definition: ImathBox.h:133
GLuint GLuint end
Definition: glcorearb.h:474
#define IMF_EXPORT
Definition: ImfExport.h:59
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108