Blame IlmImfUtil/ImfImageChannel.h

Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
//
Packit 0d464f
// Copyright (c) 2014, Industrial Light & Magic, a division of Lucas
Packit 0d464f
// Digital Ltd. LLC
Packit 0d464f
// 
Packit 0d464f
// All rights reserved.
Packit 0d464f
// 
Packit 0d464f
// Redistribution and use in source and binary forms, with or without
Packit 0d464f
// modification, are permitted provided that the following conditions are
Packit 0d464f
// met:
Packit 0d464f
// *       Redistributions of source code must retain the above copyright
Packit 0d464f
// notice, this list of conditions and the following disclaimer.
Packit 0d464f
// *       Redistributions in binary form must reproduce the above
Packit 0d464f
// copyright notice, this list of conditions and the following disclaimer
Packit 0d464f
// in the documentation and/or other materials provided with the
Packit 0d464f
// distribution.
Packit 0d464f
// *       Neither the name of Industrial Light & Magic nor the names of
Packit 0d464f
// its contributors may be used to endorse or promote products derived
Packit 0d464f
// from this software without specific prior written permission. 
Packit 0d464f
// 
Packit 0d464f
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 0d464f
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 0d464f
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 0d464f
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 0d464f
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 0d464f
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 0d464f
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 0d464f
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 0d464f
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 0d464f
//
Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
Packit 0d464f
#ifndef INCLUDED_IMF_IMAGE_CHANNEL_H
Packit 0d464f
#define INCLUDED_IMF_IMAGE_CHANNEL_H
Packit 0d464f
Packit 0d464f
//----------------------------------------------------------------------------
Packit 0d464f
//
Packit 0d464f
//      class ImageChannel
Packit 0d464f
//
Packit 0d464f
//      For an explanation of images, levels and channels,
Packit 0d464f
//      see the comments in header file Image.h.
Packit 0d464f
//
Packit 0d464f
//----------------------------------------------------------------------------
Packit 0d464f
Packit 0d464f
#include <ImfPixelType.h>
Packit 0d464f
#include <ImfFrameBuffer.h>
Packit 0d464f
#include <ImfChannelList.h>
Packit 0d464f
#include <ImathBox.h>
Packit 0d464f
#include <half.h>
Packit 0d464f
#include "ImfExport.h"
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit 0d464f
Packit 0d464f
class ImageLevel;
Packit 0d464f
Packit 0d464f
//
Packit 0d464f
// Image channels:
Packit 0d464f
//
Packit 0d464f
// An image channel holds the pixel data for a single channel of one level
Packit 0d464f
// of an image.  Separate classes for flat and deep channels are derived
Packit 0d464f
// from the ImageChannel base class.
Packit 0d464f
//
Packit 0d464f
Packit 0d464f
class ImageLevel;
Packit 0d464f
Packit 0d464f
class IMF_EXPORT ImageChannel
Packit 0d464f
{
Packit 0d464f
  public:
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // The OpenEXR pixel type of this channel (HALF, FLOAT or UINT).
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    virtual PixelType   pixelType () const = 0;
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Generate an OpenEXR channel for this image channel.
Packit 0d464f
    //
Packit 0d464f
    
Packit 0d464f
    Channel             channel () const;
Packit 0d464f
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Access to x and y sampling rates, "perceptually linear" flag,
Packit 0d464f
    // and the number of pixels that are stored in this channel.
Packit 0d464f
    // 
Packit 0d464f
Packit 0d464f
    int                 xSampling () const          {return _xSampling;}
Packit 0d464f
    int                 ySampling () const          {return _ySampling;}
Packit 0d464f
    bool                pLinear () const            {return _pLinear;}
Packit 0d464f
    int                 pixelsPerRow () const       {return _pixelsPerRow;}
Packit 0d464f
    int                 pixelsPerColumn () const    {return _pixelsPerColumn;}
Packit 0d464f
    size_t              numPixels () const          {return _numPixels;}
Packit 0d464f
Packit 0d464f
Packit 0d464f
    //
Packit 0d464f
    // Access to the image level to which this channel belongs.
Packit 0d464f
    //
Packit 0d464f
Packit 0d464f
    ImageLevel &        level ()                    {return _level;}
Packit 0d464f
    const ImageLevel &  level () const              {return _level;}
Packit 0d464f
Packit 0d464f
  protected:
Packit 0d464f
Packit 0d464f
    ImageChannel (ImageLevel &level,
Packit 0d464f
                  int xSampling,
Packit 0d464f
                  int ySampling,
Packit 0d464f
                  bool pLinear);
Packit 0d464f
Packit 0d464f
    virtual ~ImageChannel();
Packit 0d464f
Packit 0d464f
    virtual void        resize ();
Packit 0d464f
Packit 0d464f
	void                boundsCheck(int x, int y) const;
Packit 0d464f
Packit 0d464f
  private:
Packit 0d464f
Packit 0d464f
    ImageChannel (const ImageChannel &);                // not implemented
Packit 0d464f
    ImageChannel & operator = (const ImageChannel &);   // not implemented
Packit 0d464f
Packit 0d464f
    ImageLevel &        _level;
Packit 0d464f
    int                 _xSampling;
Packit 0d464f
    int                 _ySampling;
Packit 0d464f
    bool                _pLinear;
Packit 0d464f
    int                 _pixelsPerRow;
Packit 0d464f
    int                 _pixelsPerColumn;
Packit 0d464f
    size_t              _numPixels;
Packit 0d464f
};
Packit 0d464f
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit 0d464f
Packit 0d464f
#endif