| 1 | #ifndef INCLUDED_LOAD_IMAGE_H  |
| 2 | #define INCLUDED_LOAD_IMAGE_H  |
| 3 |   |
| 4 | //////////////////////////////////////////////////////////////////////////////  |
| 5 | //  |
| 6 | // Copyright (c) 2012, Industrial Light & Magic, a division of Lucasfilm  |
| 7 | // Entertainment Company Ltd. Portions contributed and copyright held by  |
| 8 | // others as indicated. All rights reserved.  |
| 9 | //  |
| 10 | // Redistribution and use in source and binary forms, with or without  |
| 11 | // modification, are permitted provided that the following conditions are  |
| 12 | // met:  |
| 13 | //  |
| 14 | // * Redistributions of source code must retain the above  |
| 15 | // copyright notice, this list of conditions and the following  |
| 16 | // disclaimer.  |
| 17 | //  |
| 18 | // * Redistributions in binary form must reproduce the above  |
| 19 | // copyright notice, this list of conditions and the following  |
| 20 | // disclaimer in the documentation and/or other materials provided with  |
| 21 | // the distribution.  |
| 22 | //  |
| 23 | // * Neither the name of Industrial Light & Magic nor the names of  |
| 24 | // any other contributors to this software may be used to endorse or  |
| 25 | // promote products derived from this software without specific prior  |
| 26 | // written permission.  |
| 27 | //  |
| 28 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS  |
| 29 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  |
| 30 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  |
| 31 | // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR  |
| 32 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  |
| 33 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  |
| 34 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  |
| 35 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  |
| 36 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  |
| 37 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  |
| 38 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
| 39 | //  |
| 40 | //////////////////////////////////////////////////////////////////////////////  |
| 41 |   |
| 42 | //----------------------------------------------------------------------------  |
| 43 | //  |
| 44 | // Load an OpenEXR image into a pixel array.  |
| 45 | //  |
| 46 | //----------------------------------------------------------------------------  |
| 47 | #include "namespaceAlias.h"  |
| 48 |   |
| 49 | #include <OpenEXR/ImfRgba.h>  |
| 50 | #include <OpenEXR/ImfArray.h>  |
| 51 | #include <OpenEXR/ImfHeader.h>  |
| 52 |   |
| 53 |   |
| 54 | namespace EXR  |
| 55 | {  |
| 56 | //  |
| 57 | // Load an OpenEXR image file:  |
| 58 | //  |
| 59 | // fileName The name of the file to be loaded.  |
| 60 | //  |
| 61 | // channel If channel is 0, load the R, G and B channels,  |
| 62 | // otherwise channel must point to the name of the  |
| 63 | // image channel to be loaded; the channel is copied  |
| 64 | // into the R, G and B components of the frame buffer.  |
| 65 | //  |
| 66 | // layer Used only if channel is 0: if layer is 0, load  |
| 67 | // the R, G and B channels, otherwise load layer.R,  |
| 68 | // layer.G and layer.B.  |
| 69 | //  |
| 70 | // preview If preview is true load the file's preview image,  |
| 71 | // otherwise load the main image.  |
| 72 | //  |
| 73 | // lx, ly If lx != 0 or ly != 0 then assume that the input  |
| 74 | // file is tiled and load level (0, 0).  |
| 75 | //  |
| 76 | // header Output -- the header of the input file, but with  |
| 77 | // the dataWindow, displayWindow and pixelAspectRatio  |
| 78 | // attributes adjusted to match what parts of the file  |
| 79 | // were actually loaded.  |
| 80 | //  |
| 81 | // pixels Output -- the pixels loaded from the file.  |
| 82 | // loadImage() resizes the pixels array to fit  |
| 83 | // the dataWindow attribute of the header.  |
| 84 | //  |
| 85 |   |
| 86 |   |
| 87 | void (const char fileName[],  |
| 88 | const char channel[],  |
| 89 | const char layer[],  |
| 90 | bool preview,  |
| 91 | int lx,  |
| 92 | int ly,  |
| 93 | int partnum,  |
| 94 | int &zsize,  |
| 95 | IMF::Header &,  |
| 96 | IMF::Array<IMF::Rgba> &pixels,  |
| 97 | IMF::Array<float*> &zbuffer,  |
| 98 | IMF::Array<unsigned int> &sampleCount,  |
| 99 | bool deepComp);  |
| 100 | }  |
| 101 |   |
| 102 |   |
| 103 | #endif  |
| 104 | |