|
Packit Service |
6754ca |
///////////////////////////////////////////////////////////////////////////
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
|
Packit Service |
6754ca |
// Digital Ltd. LLC
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// All rights reserved.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
6754ca |
// modification, are permitted provided that the following conditions are
|
|
Packit Service |
6754ca |
// met:
|
|
Packit Service |
6754ca |
// * Redistributions of source code must retain the above copyright
|
|
Packit Service |
6754ca |
// notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
6754ca |
// * Redistributions in binary form must reproduce the above
|
|
Packit Service |
6754ca |
// copyright notice, this list of conditions and the following disclaimer
|
|
Packit Service |
6754ca |
// in the documentation and/or other materials provided with the
|
|
Packit Service |
6754ca |
// distribution.
|
|
Packit Service |
6754ca |
// * Neither the name of Industrial Light & Magic nor the names of
|
|
Packit Service |
6754ca |
// its contributors may be used to endorse or promote products derived
|
|
Packit Service |
6754ca |
// from this software without specific prior written permission.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit Service |
6754ca |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit Service |
6754ca |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit Service |
6754ca |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit Service |
6754ca |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit Service |
6754ca |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit Service |
6754ca |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit Service |
6754ca |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit Service |
6754ca |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit Service |
6754ca |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit Service |
6754ca |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
///////////////////////////////////////////////////////////////////////////
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
#ifndef INCLUDED_IMF_TILED_RGBA_FILE_H
|
|
Packit Service |
6754ca |
#define INCLUDED_IMF_TILED_RGBA_FILE_H
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//-----------------------------------------------------------------------------
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Simplified RGBA image I/O for tiled files
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// class TiledRgbaOutputFile
|
|
Packit Service |
6754ca |
// class TiledRgbaInputFile
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
//-----------------------------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
#include "ImfHeader.h"
|
|
Packit Service |
6754ca |
#include "ImfFrameBuffer.h"
|
|
Packit Service |
6754ca |
#include "ImathVec.h"
|
|
Packit Service |
6754ca |
#include "ImathBox.h"
|
|
Packit Service |
6754ca |
#include "half.h"
|
|
Packit Service |
6754ca |
#include "ImfTileDescription.h"
|
|
Packit Service |
6754ca |
#include "ImfRgba.h"
|
|
Packit Service |
6754ca |
#include "ImfThreading.h"
|
|
Packit Service |
6754ca |
#include <string>
|
|
Packit Service |
6754ca |
#include "ImfNamespace.h"
|
|
Packit Service |
6754ca |
#include "ImfForward.h"
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Tiled RGBA output file.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
class IMF_EXPORT TiledRgbaOutputFile
|
|
Packit Service |
6754ca |
{
|
|
Packit Service |
6754ca |
public:
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//---------------------------------------------------
|
|
Packit Service |
6754ca |
// Constructor -- rgbaChannels, tileXSize, tileYSize,
|
|
Packit Service |
6754ca |
// levelMode, and levelRoundingMode overwrite the
|
|
Packit Service |
6754ca |
// channel list and tile description attribute in the
|
|
Packit Service |
6754ca |
// header that is passed as an argument to the
|
|
Packit Service |
6754ca |
// constructor.
|
|
Packit Service |
6754ca |
//---------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaOutputFile (const char name[],
|
|
Packit Service |
6754ca |
const Header &header,
|
|
Packit Service |
6754ca |
RgbaChannels rgbaChannels,
|
|
Packit Service |
6754ca |
int tileXSize,
|
|
Packit Service |
6754ca |
int tileYSize,
|
|
Packit Service |
6754ca |
LevelMode mode,
|
|
Packit Service |
6754ca |
LevelRoundingMode rmode = ROUND_DOWN,
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount ());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//---------------------------------------------------
|
|
Packit Service |
6754ca |
// Constructor -- like the previous one, but the new
|
|
Packit Service |
6754ca |
// TiledRgbaOutputFile is attached to a file that has
|
|
Packit Service |
6754ca |
// already been opened by the caller. Destroying
|
|
Packit Service |
6754ca |
// TiledRgbaOutputFileObjects constructed with this
|
|
Packit Service |
6754ca |
// constructor does not automatically close the
|
|
Packit Service |
6754ca |
// corresponding files.
|
|
Packit Service |
6754ca |
//---------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaOutputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
|
Packit Service |
6754ca |
const Header &header,
|
|
Packit Service |
6754ca |
RgbaChannels rgbaChannels,
|
|
Packit Service |
6754ca |
int tileXSize,
|
|
Packit Service |
6754ca |
int tileYSize,
|
|
Packit Service |
6754ca |
LevelMode mode,
|
|
Packit Service |
6754ca |
LevelRoundingMode rmode = ROUND_DOWN,
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount ());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//------------------------------------------------------
|
|
Packit Service |
6754ca |
// Constructor -- header data are explicitly specified
|
|
Packit Service |
6754ca |
// as function call arguments (an empty dataWindow means
|
|
Packit Service |
6754ca |
// "same as displayWindow")
|
|
Packit Service |
6754ca |
//------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaOutputFile (const char name[],
|
|
Packit Service |
6754ca |
int tileXSize,
|
|
Packit Service |
6754ca |
int tileYSize,
|
|
Packit Service |
6754ca |
LevelMode mode,
|
|
Packit Service |
6754ca |
LevelRoundingMode rmode,
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::Box2i &displayWindow,
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::Box2i &dataWindow = IMATH_NAMESPACE::Box2i(),
|
|
Packit Service |
6754ca |
RgbaChannels rgbaChannels = WRITE_RGBA,
|
|
Packit Service |
6754ca |
float pixelAspectRatio = 1,
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::V2f screenWindowCenter =
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::V2f (0, 0),
|
|
Packit Service |
6754ca |
float screenWindowWidth = 1,
|
|
Packit Service |
6754ca |
LineOrder lineOrder = INCREASING_Y,
|
|
Packit Service |
6754ca |
Compression compression = ZIP_COMPRESSION,
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount ());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//-----------------------------------------------
|
|
Packit Service |
6754ca |
// Constructor -- like the previous one, but both
|
|
Packit Service |
6754ca |
// the display window and the data window are
|
|
Packit Service |
6754ca |
// Box2i (V2i (0, 0), V2i (width - 1, height -1))
|
|
Packit Service |
6754ca |
//-----------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaOutputFile (const char name[],
|
|
Packit Service |
6754ca |
int width,
|
|
Packit Service |
6754ca |
int height,
|
|
Packit Service |
6754ca |
int tileXSize,
|
|
Packit Service |
6754ca |
int tileYSize,
|
|
Packit Service |
6754ca |
LevelMode mode,
|
|
Packit Service |
6754ca |
LevelRoundingMode rmode = ROUND_DOWN,
|
|
Packit Service |
6754ca |
RgbaChannels rgbaChannels = WRITE_RGBA,
|
|
Packit Service |
6754ca |
float pixelAspectRatio = 1,
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::V2f screenWindowCenter =
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::V2f (0, 0),
|
|
Packit Service |
6754ca |
float screenWindowWidth = 1,
|
|
Packit Service |
6754ca |
LineOrder lineOrder = INCREASING_Y,
|
|
Packit Service |
6754ca |
Compression compression = ZIP_COMPRESSION,
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount ());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
virtual ~TiledRgbaOutputFile ();
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//------------------------------------------------
|
|
Packit Service |
6754ca |
// Define a frame buffer as the pixel data source:
|
|
Packit Service |
6754ca |
// Pixel (x, y) is at address
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// base + x * xStride + y * yStride
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
//------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void setFrameBuffer (const Rgba *base,
|
|
Packit Service |
6754ca |
size_t xStride,
|
|
Packit Service |
6754ca |
size_t yStride);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//--------------------------
|
|
Packit Service |
6754ca |
// Access to the file header
|
|
Packit Service |
6754ca |
//--------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
const Header & header () const;
|
|
Packit Service |
6754ca |
const FrameBuffer & frameBuffer () const;
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::Box2i & displayWindow () const;
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::Box2i & dataWindow () const;
|
|
Packit Service |
6754ca |
float pixelAspectRatio () const;
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::V2f screenWindowCenter () const;
|
|
Packit Service |
6754ca |
float screenWindowWidth () const;
|
|
Packit Service |
6754ca |
LineOrder lineOrder () const;
|
|
Packit Service |
6754ca |
Compression compression () const;
|
|
Packit Service |
6754ca |
RgbaChannels channels () const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//----------------------------------------------------
|
|
Packit Service |
6754ca |
// Utility functions (same as in Imf::TiledOutputFile)
|
|
Packit Service |
6754ca |
//----------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
unsigned int tileXSize () const;
|
|
Packit Service |
6754ca |
unsigned int tileYSize () const;
|
|
Packit Service |
6754ca |
LevelMode levelMode () const;
|
|
Packit Service |
6754ca |
LevelRoundingMode levelRoundingMode () const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int numLevels () const;
|
|
Packit Service |
6754ca |
int numXLevels () const;
|
|
Packit Service |
6754ca |
int numYLevels () const;
|
|
Packit Service |
6754ca |
bool isValidLevel (int lx, int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int levelWidth (int lx) const;
|
|
Packit Service |
6754ca |
int levelHeight (int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int numXTiles (int lx = 0) const;
|
|
Packit Service |
6754ca |
int numYTiles (int ly = 0) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForLevel (int l = 0) const;
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForLevel (int lx, int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
|
Packit Service |
6754ca |
int l = 0) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
|
Packit Service |
6754ca |
int lx, int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//------------------------------------------------------------------
|
|
Packit Service |
6754ca |
// Write pixel data:
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// writeTile(dx, dy, lx, ly) writes the tile with tile
|
|
Packit Service |
6754ca |
// coordinates (dx, dy), and level number (lx, ly) to
|
|
Packit Service |
6754ca |
// the file.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// dx must lie in the interval [0, numXTiles(lx)-1]
|
|
Packit Service |
6754ca |
// dy must lie in the interval [0, numYTiles(ly)-1]
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// lx must lie in the interval [0, numXLevels()-1]
|
|
Packit Service |
6754ca |
// ly must lie in the inverval [0, numYLevels()-1]
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// writeTile(dx, dy, level) is a convenience function
|
|
Packit Service |
6754ca |
// used for ONE_LEVEL and MIPMAP_LEVEL files. It calls
|
|
Packit Service |
6754ca |
// writeTile(dx, dy, level, level).
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// The two writeTiles(dx1, dx2, dy1, dy2, ...) functions allow
|
|
Packit Service |
6754ca |
// writing multiple tiles at once. If multi-threading is used
|
|
Packit Service |
6754ca |
// multiple tiles are written concurrently.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Pixels that are outside the pixel coordinate range for the tile's
|
|
Packit Service |
6754ca |
// level, are never accessed by writeTile().
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Each tile in the file must be written exactly once.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
//------------------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void writeTile (int dx, int dy, int l = 0);
|
|
Packit Service |
6754ca |
void writeTile (int dx, int dy, int lx, int ly);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void writeTiles (int dxMin, int dxMax, int dyMin, int dyMax,
|
|
Packit Service |
6754ca |
int lx, int ly);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void writeTiles (int dxMin, int dxMax, int dyMin, int dyMax,
|
|
Packit Service |
6754ca |
int l = 0);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
// -------------------------------------------------------------------------
|
|
Packit Service |
6754ca |
// Update the preview image (see Imf::TiledOutputFile::updatePreviewImage())
|
|
Packit Service |
6754ca |
// -------------------------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void updatePreviewImage (const PreviewRgba[]);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//------------------------------------------------
|
|
Packit Service |
6754ca |
// Break a tile -- for testing and debugging only
|
|
Packit Service |
6754ca |
// (see Imf::TiledOutputFile::breakTile())
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Warning: Calling this function usually results
|
|
Packit Service |
6754ca |
// in a broken image file. The file or parts of
|
|
Packit Service |
6754ca |
// it may not be readable, or the file may contain
|
|
Packit Service |
6754ca |
// bad data.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
//------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void breakTile (int dx, int dy,
|
|
Packit Service |
6754ca |
int lx, int ly,
|
|
Packit Service |
6754ca |
int offset,
|
|
Packit Service |
6754ca |
int length,
|
|
Packit Service |
6754ca |
char c);
|
|
Packit Service |
6754ca |
private:
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Copy constructor and assignment are not implemented
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaOutputFile (const TiledRgbaOutputFile &);
|
|
Packit Service |
6754ca |
TiledRgbaOutputFile & operator = (const TiledRgbaOutputFile &);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
class ToYa;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledOutputFile * _outputFile;
|
|
Packit Service |
6754ca |
ToYa * _toYa;
|
|
Packit Service |
6754ca |
};
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Tiled RGBA input file
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
class IMF_EXPORT TiledRgbaInputFile
|
|
Packit Service |
6754ca |
{
|
|
Packit Service |
6754ca |
public:
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//--------------------------------------------------------
|
|
Packit Service |
6754ca |
// Constructor -- opens the file with the specified name.
|
|
Packit Service |
6754ca |
// Destroying TiledRgbaInputFile objects constructed with
|
|
Packit Service |
6754ca |
// this constructor automatically closes the corresponding
|
|
Packit Service |
6754ca |
// files.
|
|
Packit Service |
6754ca |
//--------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaInputFile (const char name[],
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount ());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//-------------------------------------------------------
|
|
Packit Service |
6754ca |
// Constructor -- attaches the new TiledRgbaInputFile
|
|
Packit Service |
6754ca |
// object to a file that has already been opened by the
|
|
Packit Service |
6754ca |
// caller.
|
|
Packit Service |
6754ca |
// Destroying TiledRgbaInputFile objects constructed with
|
|
Packit Service |
6754ca |
// this constructor does not automatically close the
|
|
Packit Service |
6754ca |
// corresponding files.
|
|
Packit Service |
6754ca |
//-------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThreads = globalThreadCount ());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//------------------------------------------------------------
|
|
Packit Service |
6754ca |
// Constructors -- the same as the previous two, but the names
|
|
Packit Service |
6754ca |
// of the red, green, blue, alpha, and luminance channels are
|
|
Packit Service |
6754ca |
// expected to be layerName.R, layerName.G, etc.
|
|
Packit Service |
6754ca |
//------------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaInputFile (const char name[],
|
|
Packit Service |
6754ca |
const std::string &layerName,
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
|
|
Packit Service |
6754ca |
const std::string &layerName,
|
|
Packit Service |
6754ca |
int numThreads = globalThreadCount());
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//-----------
|
|
Packit Service |
6754ca |
// Destructor
|
|
Packit Service |
6754ca |
//-----------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
virtual ~TiledRgbaInputFile ();
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//-----------------------------------------------------
|
|
Packit Service |
6754ca |
// Define a frame buffer as the pixel data destination:
|
|
Packit Service |
6754ca |
// Pixel (x, y) is at address
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// base + x * xStride + y * yStride
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
//-----------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void setFrameBuffer (Rgba *base,
|
|
Packit Service |
6754ca |
size_t xStride,
|
|
Packit Service |
6754ca |
size_t yStride);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//-------------------------------------------------------------------
|
|
Packit Service |
6754ca |
// Switch to a different layer -- subsequent calls to readTile()
|
|
Packit Service |
6754ca |
// and readTiles() will read channels layerName.R, layerName.G, etc.
|
|
Packit Service |
6754ca |
// After each call to setLayerName(), setFrameBuffer() must be called
|
|
Packit Service |
6754ca |
// at least once before the next call to readTile() or readTiles().
|
|
Packit Service |
6754ca |
//-------------------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void setLayerName (const std::string &layerName);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//--------------------------
|
|
Packit Service |
6754ca |
// Access to the file header
|
|
Packit Service |
6754ca |
//--------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
const Header & header () const;
|
|
Packit Service |
6754ca |
const FrameBuffer & frameBuffer () const;
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::Box2i & displayWindow () const;
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::Box2i & dataWindow () const;
|
|
Packit Service |
6754ca |
float pixelAspectRatio () const;
|
|
Packit Service |
6754ca |
const IMATH_NAMESPACE::V2f screenWindowCenter () const;
|
|
Packit Service |
6754ca |
float screenWindowWidth () const;
|
|
Packit Service |
6754ca |
LineOrder lineOrder () const;
|
|
Packit Service |
6754ca |
Compression compression () const;
|
|
Packit Service |
6754ca |
RgbaChannels channels () const;
|
|
Packit Service |
6754ca |
const char * fileName () const;
|
|
Packit Service |
6754ca |
bool isComplete () const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//----------------------------------
|
|
Packit Service |
6754ca |
// Access to the file format version
|
|
Packit Service |
6754ca |
//----------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int version () const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//---------------------------------------------------
|
|
Packit Service |
6754ca |
// Utility functions (same as in Imf::TiledInputFile)
|
|
Packit Service |
6754ca |
//---------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
unsigned int tileXSize () const;
|
|
Packit Service |
6754ca |
unsigned int tileYSize () const;
|
|
Packit Service |
6754ca |
LevelMode levelMode () const;
|
|
Packit Service |
6754ca |
LevelRoundingMode levelRoundingMode () const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int numLevels () const;
|
|
Packit Service |
6754ca |
int numXLevels () const;
|
|
Packit Service |
6754ca |
int numYLevels () const;
|
|
Packit Service |
6754ca |
bool isValidLevel (int lx, int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int levelWidth (int lx) const;
|
|
Packit Service |
6754ca |
int levelHeight (int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
int numXTiles (int lx = 0) const;
|
|
Packit Service |
6754ca |
int numYTiles (int ly = 0) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForLevel (int l = 0) const;
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForLevel (int lx, int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
|
Packit Service |
6754ca |
int l = 0) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
|
Packit Service |
6754ca |
int lx, int ly) const;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//----------------------------------------------------------------
|
|
Packit Service |
6754ca |
// Read pixel data:
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// readTile(dx, dy, lx, ly) reads the tile with tile
|
|
Packit Service |
6754ca |
// coordinates (dx, dy), and level number (lx, ly),
|
|
Packit Service |
6754ca |
// and stores it in the current frame buffer.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// dx must lie in the interval [0, numXTiles(lx)-1]
|
|
Packit Service |
6754ca |
// dy must lie in the interval [0, numYTiles(ly)-1]
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// lx must lie in the interval [0, numXLevels()-1]
|
|
Packit Service |
6754ca |
// ly must lie in the inverval [0, numYLevels()-1]
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// readTile(dx, dy, level) is a convenience function used
|
|
Packit Service |
6754ca |
// for ONE_LEVEL and MIPMAP_LEVELS files. It calls
|
|
Packit Service |
6754ca |
// readTile(dx, dy, level, level).
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// The two readTiles(dx1, dx2, dy1, dy2, ...) functions allow
|
|
Packit Service |
6754ca |
// reading multiple tiles at once. If multi-threading is used
|
|
Packit Service |
6754ca |
// multiple tiles are read concurrently.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Pixels that are outside the pixel coordinate range for the
|
|
Packit Service |
6754ca |
// tile's level, are never accessed by readTile().
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Attempting to access a tile that is not present in the file
|
|
Packit Service |
6754ca |
// throws an InputExc exception.
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
//----------------------------------------------------------------
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void readTile (int dx, int dy, int l = 0);
|
|
Packit Service |
6754ca |
void readTile (int dx, int dy, int lx, int ly);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void readTiles (int dxMin, int dxMax,
|
|
Packit Service |
6754ca |
int dyMin, int dyMax, int lx, int ly);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
void readTiles (int dxMin, int dxMax,
|
|
Packit Service |
6754ca |
int dyMin, int dyMax, int l = 0);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
private:
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
// Copy constructor and assignment are not implemented
|
|
Packit Service |
6754ca |
//
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledRgbaInputFile (const TiledRgbaInputFile &);
|
|
Packit Service |
6754ca |
TiledRgbaInputFile & operator = (const TiledRgbaInputFile &);
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
class FromYa;
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
TiledInputFile * _inputFile;
|
|
Packit Service |
6754ca |
FromYa * _fromYa;
|
|
Packit Service |
6754ca |
std::string _channelNamePrefix;
|
|
Packit Service |
6754ca |
};
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
|
|
Packit Service |
6754ca |
#endif
|