OpenImageIO::ImageInput Class Reference

#include <imageio.h>

List of all members.

Public Member Functions

virtual const char * format_name (void) const =0
virtual bool open (const std::string &name, ImageSpec &newspec)=0
virtual bool open (const std::string &name, ImageSpec &newspec, const ImageSpec &config)
const ImageSpecspec (void) const
virtual bool close ()=0
virtual int current_subimage (void) const
virtual bool seek_subimage (int index, ImageSpec &newspec)
virtual bool read_scanline (int y, int z, TypeDesc format, void *data, stride_t xstride=AutoStride)
bool read_scanline (int y, int z, float *data)
virtual bool read_tile (int x, int y, int z, TypeDesc format, void *data, stride_t xstride=AutoStride, stride_t ystride=AutoStride, stride_t zstride=AutoStride)
bool read_tile (int x, int y, int z, float *data)
virtual bool read_image (TypeDesc format, void *data, stride_t xstride=AutoStride, stride_t ystride=AutoStride, stride_t zstride=AutoStride, ProgressCallback progress_callback=NULL, void *progress_callback_data=NULL)
bool read_image (float *data)
virtual bool read_native_scanline (int y, int z, void *data)=0
virtual bool read_native_tile (int x, int y, int z, void *data)
virtual int send_to_input (const char *format,...)
int send_to_client (const char *format,...)
std::string geterror () const
std::string error_message () const

Static Public Member Functions

static ImageInputcreate (const std::string &filename, const std::string &plugin_searchpath="")

Protected Member Functions

void error (const char *format,...) OPENIMAGEIO_PRINTF_ARGS(2

Protected Attributes

ImageSpec m_spec
 format spec of the current open subimage

Detailed Description

ImageOutput abstracts the reading of an image file in a file format-agnostic manner.


Member Function Documentation

virtual bool OpenImageIO::ImageInput::close (  )  [pure virtual]

Close an image that we are totally done with.

static ImageInput* OpenImageIO::ImageInput::create ( const std::string &  filename,
const std::string &  plugin_searchpath = "" 
) [static]

Create and return an ImageInput implementation that is willing to read the given file. The plugin_searchpath parameter is a colon-separated list of directories to search for ImageIO plugin DSO/DLL's (not a searchpath for the image itself!). This will actually just try every imageio plugin it can locate, until it finds one that's able to open the file without error. This just creates the ImageInput, it does not open the file.

virtual int OpenImageIO::ImageInput::current_subimage ( void   )  const [inline, virtual]

Returns the index of the subimage that is currently being read. The first subimage (or the only subimage, if there is just one) is number 0.

void OpenImageIO::ImageInput::error ( const char *  format,
  ... 
) [protected]

Error reporting for the plugin implementation: call this with printf-like arguments.

std::string OpenImageIO::ImageInput::error_message (  )  const [inline]

Deprecated

virtual const char* OpenImageIO::ImageInput::format_name ( void   )  const [pure virtual]

Return the name of the format implemented by this class.

std::string OpenImageIO::ImageInput::geterror ( void   )  const [inline]

If any of the API routines returned false indicating an error, this routine will return the error string (and clear any error flags). If no error has occurred since the last time geterror() was called, it will return an empty string.

virtual bool OpenImageIO::ImageInput::open ( const std::string &  name,
ImageSpec newspec,
const ImageSpec config 
) [inline, virtual]

Open file with given name, similar to open(name,newspec). The 'config' is an ImageSpec giving requests or special instructions. ImageInput implementations are free to not respond to any such requests, so the default implementation is just to ignore config and call regular open(name,newspec).

virtual bool OpenImageIO::ImageInput::open ( const std::string &  name,
ImageSpec newspec 
) [pure virtual]

Open file with given name. Various file attributes are put in newspec and a copy is also saved in this->spec. From these attributes, you can discern the resolution, if it's tiled, number of channels, and native data format. Return true if the file was found and opened okay.

bool OpenImageIO::ImageInput::read_image ( float *  data  )  [inline]

Simple read_image reads to contiguous float pixels.

virtual bool OpenImageIO::ImageInput::read_image ( TypeDesc  format,
void *  data,
stride_t  xstride = AutoStride,
stride_t  ystride = AutoStride,
stride_t  zstride = AutoStride,
ProgressCallback  progress_callback = NULL,
void *  progress_callback_data = NULL 
) [virtual]

Read the entire image of spec.width x spec.height x spec.depth pixels into data (which must already be sized large enough for the entire image) with the given strides and in the desired format. Read tiles or scanlines automatically. Strides set to AutoStride imply 'contiguous' data, i.e., xstride == spec.nchannels*format.size() ystride == xstride*spec.width zstride == ystride*spec.height Because this may be an expensive operation, a progress callback may be passed. Periodically, it will be called as follows: progress_callback (progress_callback_data, float done) where 'done' gives the portion of the image

virtual bool OpenImageIO::ImageInput::read_native_scanline ( int  y,
int  z,
void *  data 
) [pure virtual]

read_native_scanline is just like read_scanline, except that it keeps the data in the native format of the disk file and always read into contiguous memory (no strides). It's up to the user to have enough space allocated and know what to do with the data. IT IS EXPECTED THAT EACH FORMAT PLUGIN WILL OVERRIDE THIS METHOD.

virtual bool OpenImageIO::ImageInput::read_native_tile ( int  x,
int  y,
int  z,
void *  data 
) [inline, virtual]

read_native_tile is just like read_tile, except that it keeps the data in the native format of the disk file and always read into contiguous memory (no strides). It's up to the user to have enough space allocated and know what to do with the data. IT IS EXPECTED THAT EACH FORMAT PLUGIN WILL OVERRIDE THIS METHOD IF IT SUPPORTS TILED IMAGES.

bool OpenImageIO::ImageInput::read_scanline ( int  y,
int  z,
float *  data 
) [inline]

Simple read_scanline reads to contiguous float pixels.

virtual bool OpenImageIO::ImageInput::read_scanline ( int  y,
int  z,
TypeDesc  format,
void *  data,
stride_t  xstride = AutoStride 
) [virtual]

Read the scanline that includes pixels (*,y,z) into data, converting if necessary from the native data format of the file into the 'format' specified (z==0 for non-volume images). The stride value gives the data spacing of adjacent pixels (in bytes). Strides set to AutoStride imply 'contiguous' data, i.e., xstride == spec.nchannels*format.size() The reader is expected to give the appearance of random access -- in other words, if it can't randomly seek to the given scanline, it should transparently close, reopen, and sequentially read through prior scanlines. The base ImageInput class has a default implementation that calls read_native_scanline and then does appropriate format conversion, so there's no reason for each format plugin to override this method.

bool OpenImageIO::ImageInput::read_tile ( int  x,
int  y,
int  z,
float *  data 
) [inline]

Simple read_tile reads to contiguous float pixels.

virtual bool OpenImageIO::ImageInput::read_tile ( int  x,
int  y,
int  z,
TypeDesc  format,
void *  data,
stride_t  xstride = AutoStride,
stride_t  ystride = AutoStride,
stride_t  zstride = AutoStride 
) [virtual]

Read the tile that includes pixels (*,y,z) into data, converting if necessary from the native data format of the file into the 'format' specified. (z==0 for non-volume images.) The stride values give the data spacing of adjacent pixels, scanlines, and volumetric slices (measured in bytes). Strides set to AutoStride imply 'contiguous' data, i.e., xstride == spec.nchannels*format.size() ystride == xstride*spec.tile_width zstride == ystride*spec.tile_height The reader is expected to give the appearance of random access -- in other words, if it can't randomly seek to the given tile, it should transparently close, reopen, and sequentially read through prior tiles. The base ImageInput class has a default implementation that calls read_native_tile and then does appropriate format conversion, so there's no reason for each format plugin to override this method.

virtual bool OpenImageIO::ImageInput::seek_subimage ( int  index,
ImageSpec newspec 
) [inline, virtual]

Seek to the given subimage. The first subimage of the file has index 0. Return true on success, false on failure (including that there is not a subimage with that index). The new subimage's vital statistics are put in newspec (and also saved in this->spec). The reader is expected to give the appearance of random access to subimages -- in other words, if it can't randomly seek to the given subimage, it should transparently close, reopen, and sequentially read through prior subimages.

virtual int OpenImageIO::ImageInput::send_to_input ( const char *  format,
  ... 
) [virtual]

General message passing between client and image input server

const ImageSpec& OpenImageIO::ImageInput::spec ( void   )  const [inline]

Return a reference to the image format specification of the current subimage. Note that the contents of the spec are invalid before open() or after close().


Member Data Documentation

format spec of the current open subimage


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Tue Oct 27 06:30:41 2009 for OpenImageIO by  doxygen 1.6.1