HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 
50  DeepScanLineOutputPart(MultiPartOutputFile& multiPartFile, int partNumber);
51 
52  //------------------------
53  // Access to the file name
54  //------------------------
55 
57  const char * fileName () const;
58 
59 
60  //--------------------------
61  // Access to the file header
62  //--------------------------
63 
65  const Header & header () const;
66 
67 
68  //-------------------------------------------------------
69  // Set the current frame buffer -- copies the FrameBuffer
70  // object into the OutputFile object.
71  //
72  // The current frame buffer is the source of the pixel
73  // data written to the file. The current frame buffer
74  // must be set at least once before writePixels() is
75  // called. The current frame buffer can be changed
76  // after each call to writePixels.
77  //-------------------------------------------------------
78 
81 
82 
83  //-----------------------------------
84  // Access to the current frame buffer
85  //-----------------------------------
86 
88  const DeepFrameBuffer & frameBuffer () const;
89 
90 
91  //-------------------------------------------------------------------
92  // Write pixel data:
93  //
94  // writePixels(n) retrieves the next n scan lines worth of data from
95  // the current frame buffer, starting with the scan line indicated by
96  // currentScanLine(), and stores the data in the output file, and
97  // progressing in the direction indicated by header.lineOrder().
98  //
99  // To produce a complete and correct file, exactly m scan lines must
100  // be written, where m is equal to
101  // header().dataWindow().max.y - header().dataWindow().min.y + 1.
102  //-------------------------------------------------------------------
103 
104  IMF_EXPORT
105  void writePixels (int numScanLines = 1);
106 
107 
108  //------------------------------------------------------------------
109  // Access to the current scan line:
110  //
111  // currentScanLine() returns the y coordinate of the first scan line
112  // that will be read from the current frame buffer during the next
113  // call to writePixels().
114  //
115  // If header.lineOrder() == INCREASING_Y:
116  //
117  // The current scan line before the first call to writePixels()
118  // is header().dataWindow().min.y. After writing each scan line,
119  // the current scan line is incremented by 1.
120  //
121  // If header.lineOrder() == DECREASING_Y:
122  //
123  // The current scan line before the first call to writePixels()
124  // is header().dataWindow().max.y. After writing each scan line,
125  // the current scan line is decremented by 1.
126  //
127  //------------------------------------------------------------------
128 
129  IMF_EXPORT
130  int currentScanLine () const;
131 
132 
133  //--------------------------------------------------------------
134  // Shortcut to copy all pixels from an InputFile into this file,
135  // without uncompressing and then recompressing the pixel data.
136  // This file's header must be compatible with the InputFile's
137  // header: The two header's "dataWindow", "compression",
138  // "lineOrder" and "channels" attributes must be the same.
139  //--------------------------------------------------------------
140 
141  IMF_EXPORT
143  IMF_EXPORT
145 
146 
147  //--------------------------------------------------------------
148  // Updating the preview image:
149  //
150  // updatePreviewImage() supplies a new set of pixels for the
151  // preview image attribute in the file's header. If the header
152  // does not contain a preview image, updatePreviewImage() throws
153  // an IEX_NAMESPACE::LogicExc.
154  //
155  // Note: updatePreviewImage() is necessary because images are
156  // often stored in a file incrementally, a few scan lines at a
157  // time, while the image is being generated. Since the preview
158  // image is an attribute in the file's header, it gets stored in
159  // the file as soon as the file is opened, but we may not know
160  // what the preview image should look like until we have written
161  // the last scan line of the main image.
162  //
163  //--------------------------------------------------------------
164 
165  IMF_EXPORT
166  void updatePreviewImage (const PreviewRgba newPixels[]);
167 
168  private:
170 };
171 
173 
174 
175 
176 
177 
178 #endif /* IMFDEEPSCANLINEOUTPUTPART_H_ */
IMF_EXPORT const Header & header() const
IMF_EXPORT DeepScanLineOutputPart(MultiPartOutputFile &multiPartFile, int partNumber)
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
IMF_EXPORT int currentScanLine() const
GLuint in
Definition: glew.h:11552
IMF_EXPORT void setFrameBuffer(const DeepFrameBuffer &frameBuffer)
IMF_EXPORT void copyPixels(DeepScanLineInputFile &in)
IMF_EXPORT void writePixels(int numScanLines=1)
#define IMF_EXPORT
Definition: ImfExport.h:44
IMF_EXPORT const DeepFrameBuffer & frameBuffer() const
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108
IMF_EXPORT const char * fileName() const
IMF_EXPORT void updatePreviewImage(const PreviewRgba newPixels[])