HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ImfDeepScanLineOutputPart.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
4 // Digital Ltd. LLC
5 //
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
16 // distribution.
17 // * Neither the name of Industrial Light & Magic nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
33 ///////////////////////////////////////////////////////////////////////////
34 
35 #ifndef IMFDEEPSCANLINEOUTPUTPART_H_
36 #define IMFDEEPSCANLINEOUTPUTPART_H_
37 
39 #include "ImfMultiPartOutputFile.h"
40 #include "ImfNamespace.h"
41 #include "ImfExport.h"
42 
44 
46 {
47  public:
48 
49  DeepScanLineOutputPart(MultiPartOutputFile& multiPartFile, int partNumber);
50 
51  //------------------------
52  // Access to the file name
53  //------------------------
54 
55  const char * fileName () const;
56 
57 
58  //--------------------------
59  // Access to the file header
60  //--------------------------
61 
62  const Header & header () const;
63 
64 
65  //-------------------------------------------------------
66  // Set the current frame buffer -- copies the FrameBuffer
67  // object into the OutputFile object.
68  //
69  // The current frame buffer is the source of the pixel
70  // data written to the file. The current frame buffer
71  // must be set at least once before writePixels() is
72  // called. The current frame buffer can be changed
73  // after each call to writePixels.
74  //-------------------------------------------------------
75 
76  void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
77 
78 
79  //-----------------------------------
80  // Access to the current frame buffer
81  //-----------------------------------
82 
83  const DeepFrameBuffer & frameBuffer () const;
84 
85 
86  //-------------------------------------------------------------------
87  // Write pixel data:
88  //
89  // writePixels(n) retrieves the next n scan lines worth of data from
90  // the current frame buffer, starting with the scan line indicated by
91  // currentScanLine(), and stores the data in the output file, and
92  // progressing in the direction indicated by header.lineOrder().
93  //
94  // To produce a complete and correct file, exactly m scan lines must
95  // be written, where m is equal to
96  // header().dataWindow().max.y - header().dataWindow().min.y + 1.
97  //-------------------------------------------------------------------
98 
99  void writePixels (int numScanLines = 1);
100 
101 
102  //------------------------------------------------------------------
103  // Access to the current scan line:
104  //
105  // currentScanLine() returns the y coordinate of the first scan line
106  // that will be read from the current frame buffer during the next
107  // call to writePixels().
108  //
109  // If header.lineOrder() == INCREASING_Y:
110  //
111  // The current scan line before the first call to writePixels()
112  // is header().dataWindow().min.y. After writing each scan line,
113  // the current scan line is incremented by 1.
114  //
115  // If header.lineOrder() == DECREASING_Y:
116  //
117  // The current scan line before the first call to writePixels()
118  // is header().dataWindow().max.y. After writing each scan line,
119  // the current scan line is decremented by 1.
120  //
121  //------------------------------------------------------------------
122 
123  int currentScanLine () const;
124 
125 
126  //--------------------------------------------------------------
127  // Shortcut to copy all pixels from an InputFile into this file,
128  // without uncompressing and then recompressing the pixel data.
129  // This file's header must be compatible with the InputFile's
130  // header: The two header's "dataWindow", "compression",
131  // "lineOrder" and "channels" attributes must be the same.
132  //--------------------------------------------------------------
133 
134  void copyPixels (DeepScanLineInputFile &in);
135  void copyPixels (DeepScanLineInputPart &in);
136 
137 
138  //--------------------------------------------------------------
139  // Updating the preview image:
140  //
141  // updatePreviewImage() supplies a new set of pixels for the
142  // preview image attribute in the file's header. If the header
143  // does not contain a preview image, updatePreviewImage() throws
144  // an IEX_NAMESPACE::LogicExc.
145  //
146  // Note: updatePreviewImage() is necessary because images are
147  // often stored in a file incrementally, a few scan lines at a
148  // time, while the image is being generated. Since the preview
149  // image is an attribute in the file's header, it gets stored in
150  // the file as soon as the file is opened, but we may not know
151  // what the preview image should look like until we have written
152  // the last scan line of the main image.
153  //
154  //--------------------------------------------------------------
155 
156  void updatePreviewImage (const PreviewRgba newPixels[]);
157 
158  private:
160 };
161 
163 
164 
165 
166 
167 
168 #endif /* IMFDEEPSCANLINEOUTPUTPART_H_ */
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
#define IMF_EXPORT
Definition: ImfExport.h:59
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108