IMG_Format Class Reference

#include <IMG_Format.h>

Inheritance diagram for IMG_Format:

HDK_Sample::IMG_RawFormat IMG_FormatPassThru

List of all members.

Public Member Functions

 IMG_Format ()
 IMG_Format (bool addtolist)
virtual ~IMG_Format ()
IMG_FileallocValidFile () const
virtual const char * getFormatDescription () const
virtual bool isPassThrough () const
virtual const char * getDefaultExtension () const
virtual const char * getFormatLocation () const
 Describes how the format was loaded (i.e. DSO or internal formats).
virtual int checkDevice (const char *) const
virtual IMG_DataType getSupportedTypes () const =0
 Returns a bitfield of data types supported by this format.
virtual IMG_ColorModel getSupportedColorModels () const =0
virtual void getMaxResolution (unsigned &x, unsigned &y) const =0
virtual int isTopFirst () const
virtual int isLeftFirst () const
virtual const char * getFormatName () const =0
virtual const char * getFormatLabel () const
virtual int checkExtension (const char *filename) const =0
virtual int checkMagic (unsigned int) const
virtual int checkMagicSeekable (UT_IStream &is) const
virtual int isReadRandomAccess () const
virtual int isWriteRandomAccess () const

Static Public Member Functions

static const IMG_FormatfindFormatByName (const char *format_name)
static const IMG_FormatfindFormatByLabel (const char *format_label)
static const IMG_FormatfindFormatSeekable (UT_IStream &is)
static const IMG_FormatfindFormatNonSeekable (UT_IStream &is)
static const IMG_FormatgetStdoutFormat ()
static int getNFormats ()
static const IMG_FormatgetFormat (int idx)
 Access to the list of currently installed image formats.
static const IMG_FormatfindFormatReadable (const char *filename, const IMG_Stat *stat=0)
static const IMG_FormatfindFormatWritable (const char *filename, const IMG_Stat *stat=0)
virtual bool isReadable () const
virtual bool isWritable () const
virtual bool isDataWindowSupported () const
 does this format support a data window or sub-area.
virtual bool isDataWindowCropOnly () const
virtual bool isDataWindowStreakSupported () const
virtual bool isDeepRasterSupported () const
virtual IMG_DeepRasterColor getDeepRasterRGBASupport () const
virtual bool isDataInterleaved () const
virtual bool canPlaneTypesDiffer () const
virtual const IMG_FileOptionListgetOptions () const
virtual const IMG_FormatresolvePriority (const IMG_Format *format) const
static void setGlobalOption (const char *name, const char *value)
 Set an option globally for all formats. Use with extreme care.
static void getGlobalOption (const char *name, UT_String &value)
 Read the value of a global option. May return a NULL string.
static bool setFormatOptionDefault (const char *format_name, const char *format_option, const char *defvalue)
static bool getFormatOptionDefault (const char *format_name, const char *format_option, UT_String &defvalue)
static int matchExtension (const char *filename, const char *ext)
 Matches a filename against a single extension.
static int matchExtensions (const char *filename, const char *ext[])
virtual IMG_FilecreateFile () const =0
virtual int isFormatOk (const IMG_Stat &stat) const
void removeFormatFromList ()
const IMG_FileTagListgetGlobalTags ()
static const IMG_FormatfindFormat (const char *filename, const IMG_Stat *stat, bool for_read)


Detailed Description

Description of a specific image file format, describing the characteristics and capabilities of a specific image file format. It can be used to query the capabilities of that format (resolution limits, data formats supported, image orientation, etc). Image file-specific data (such as resolution of a given file) can be found in IMG_Stat.
When writing a new data format, many of the virtuals will need to be overridden to properly describe its capabilities.
Examples:

IMG/IMG_Raw.C.

Definition at line 48 of file IMG_Format.h.


Constructor & Destructor Documentation

IMG_Format::IMG_Format (  ) 

IMG_Format::IMG_Format ( bool  addtolist  )  [explicit]

This is a version of the constructor that lets you avoid adding oneself to the list. This is used by the pass throug filter and must be used if you are in multithreaded code as the underlying list is not locked.

virtual IMG_Format::~IMG_Format (  )  [virtual]


Member Function Documentation

IMG_File* IMG_Format::allocValidFile (  )  const

virtual bool IMG_Format::canPlaneTypesDiffer (  )  const [virtual]

if true, planes can have different data formats & components. Otherwise, all planes must have the same data type and number of components.

Reimplemented in IMG_FormatPassThru.

virtual int IMG_Format::checkDevice ( const char *   )  const [virtual]

The device method gives a higher priority to device checks. By default, this method returns 0 (no match). This is used to allow things like a60:3.pic (which uses the abekas device).

Reimplemented in IMG_FormatPassThru.

virtual int IMG_Format::checkExtension ( const char *  filename  )  const [pure virtual]

Methods to determine if this is one of our recognized files. The extension is the first try. If there are multiple matches, then we resort to the magic number (when reading)

Implemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual int IMG_Format::checkMagic ( unsigned  int  )  const [virtual]

If possible, this magic numver checker will be called. This is used if the file is "seekable" (i.e. that we can rewind after checking)

Reimplemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual int IMG_Format::checkMagicSeekable ( UT_IStream is  )  const [virtual]

If possible, this second magic number checker will be called. This is used if the file is "seekable" (i.e. that we can rewind after checking)

Reimplemented in IMG_FormatPassThru.

virtual IMG_File* IMG_Format::createFile (  )  const [protected, pure virtual]

Specifies if this format can read an image file. One of isReadable() or isWritable() (or both) must return true.

Implemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

static const IMG_Format* IMG_Format::findFormat ( const char *  filename,
const IMG_Stat stat,
bool  for_read 
) [static, protected]

Specifies if this format can read an image file. One of isReadable() or isWritable() (or both) must return true.

static const IMG_Format* IMG_Format::findFormatByLabel ( const char *  format_label  )  [static]

static const IMG_Format* IMG_Format::findFormatByName ( const char *  format_name  )  [static]

static const IMG_Format* IMG_Format::findFormatNonSeekable ( UT_IStream is  )  [static]

static const IMG_Format* IMG_Format::findFormatReadable ( const char *  filename,
const IMG_Stat stat = 0 
) [static]

Find a format given a filename and a stat - only extension matching. Will only return formats that can read files (isReadable()).

static const IMG_Format* IMG_Format::findFormatSeekable ( UT_IStream is  )  [static]

static const IMG_Format* IMG_Format::findFormatWritable ( const char *  filename,
const IMG_Stat stat = 0 
) [static]

Find a format given a filename and a stat - only extension matching. Will only return formats that can write files (isWritable()).

virtual IMG_DeepRasterColor IMG_Format::getDeepRasterRGBASupport (  )  const [virtual]

does this deep raster allow RGBA in one plane (true) or split into 2 planes (RGB, A). (default false)

virtual const char* IMG_Format::getDefaultExtension (  )  const [virtual]

The default extension is used to determine whether the format should appear in the device/format menus. It should not contain the '.' (i.e. "tif" not ".tif")

Reimplemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

static const IMG_Format* IMG_Format::getFormat ( int  idx  )  [static]

Access to the list of currently installed image formats.

virtual const char* IMG_Format::getFormatDescription (  )  const [virtual]

This can be optionally overridden to return a short description of the format. By default, no description is given.

Reimplemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual const char* IMG_Format::getFormatLabel (  )  const [virtual]

If getFormatLabel() is not overridden, the label will be the same as the name.

Reimplemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual const char* IMG_Format::getFormatLocation (  )  const [inline, virtual]

Describes how the format was loaded (i.e. DSO or internal formats).

Reimplemented in IMG_FormatPassThru.

Definition at line 106 of file IMG_Format.h.

virtual const char* IMG_Format::getFormatName (  )  const [pure virtual]

All formats must have a unique name (like "JPEG").

Implemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

Examples:
IMG/IMG_Raw.C.

static bool IMG_Format::getFormatOptionDefault ( const char *  format_name,
const char *  format_option,
UT_String defvalue 
) [static]

Returns the value of a format-specific option. Returns false if the format or option does not exist.

static void IMG_Format::getGlobalOption ( const char *  name,
UT_String value 
) [static]

Read the value of a global option. May return a NULL string.

const IMG_FileTagList* IMG_Format::getGlobalTags (  )  [protected]

Specifies if this format can read an image file. One of isReadable() or isWritable() (or both) must return true.

virtual void IMG_Format::getMaxResolution ( unsigned &  x,
unsigned &  y 
) const [pure virtual]

Maximum allowable resolution for the file. If a user attempts to write an image larger than this, the image will be scaled to this resolution.

Implemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

static int IMG_Format::getNFormats (  )  [static]

number of currently installed image formats

virtual const IMG_FileOptionList* IMG_Format::getOptions (  )  const [virtual]

Returns a list of options that can be set on the format when reading or writing (like 'compression' or 'comment').

Reimplemented in IMG_FormatPassThru.

static const IMG_Format* IMG_Format::getStdoutFormat (  )  [static]

virtual IMG_ColorModel IMG_Format::getSupportedColorModels (  )  const [pure virtual]

Returns a bitfield of supported color models. If IMG_CM_REVERSED is set, this format stores data in BGR/ABGR format.

Implemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual IMG_DataType IMG_Format::getSupportedTypes (  )  const [pure virtual]

Returns a bitfield of data types supported by this format.

Implemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual bool IMG_Format::isDataInterleaved (  )  const [virtual]

Specifies whether this format stores its data interleaved (RGBRGBRGB) or non-interleaved (RRRGGGBBB). If your format supports both, pick one.

Reimplemented in IMG_FormatPassThru.

virtual bool IMG_Format::isDataWindowCropOnly (  )  const [virtual]

if true, this format only supports data windows contained within the image resolution (a crop region).

virtual bool IMG_Format::isDataWindowStreakSupported (  )  const [virtual]

does this format support saving whether the data outside the window is streaked from the window edges?

Reimplemented in IMG_FormatPassThru.

virtual bool IMG_Format::isDataWindowSupported (  )  const [virtual]

does this format support a data window or sub-area.

Reimplemented in IMG_FormatPassThru.

virtual bool IMG_Format::isDeepRasterSupported (  )  const [virtual]

does this format support deep rasters or multiple images? If not, only one plane of the color models that this format supports is allowed.

Reimplemented in IMG_FormatPassThru.

virtual int IMG_Format::isFormatOk ( const IMG_Stat stat  )  const [protected, virtual]

Specifies if this format can read an image file. One of isReadable() or isWritable() (or both) must return true.

Reimplemented in IMG_FormatPassThru.

virtual int IMG_Format::isLeftFirst (  )  const [virtual]

horizontal data orientation. Where (0,0) lies in the image (top-left by default).

Reimplemented in IMG_FormatPassThru.

virtual bool IMG_Format::isPassThrough (  )  const [inline, virtual]

Flags whether the format is a pass through format like Flip or Scale. Specific image formats (like JPEG) are never pass-through.

Reimplemented in IMG_FormatPassThru.

Definition at line 98 of file IMG_Format.h.

virtual bool IMG_Format::isReadable (  )  const [virtual]

Specifies if this format can read an image file. One of isReadable() or isWritable() (or both) must return true.

virtual int IMG_Format::isReadRandomAccess (  )  const [virtual]

Some formats can be read and written in random order. Others require strict sequential order. If these methods return false, you should read and write scanlines in ascending order. When writing, they will be cached until they can be written sequentially.

Reimplemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

virtual int IMG_Format::isTopFirst (  )  const [virtual]

vertical data orientation. Where (0,0) lies in the image (top-left by default).

Reimplemented in IMG_FormatPassThru.

virtual bool IMG_Format::isWritable (  )  const [virtual]

Specifies if this format can write an image file. One of isReadable() or isWritable() (or both) must return true.

virtual int IMG_Format::isWriteRandomAccess (  )  const [virtual]

If 0 is returned, the scanlines must be written in sequential order or they will be cached until all scanlines can be written sequentially.

Reimplemented in IMG_FormatPassThru, and HDK_Sample::IMG_RawFormat.

static int IMG_Format::matchExtension ( const char *  filename,
const char *  ext 
) [static]

Matches a filename against a single extension.

static int IMG_Format::matchExtensions ( const char *  filename,
const char *  ext[] 
) [static]

Matches a filename against a list of extensions (the last entry must be NULL)

Examples:
IMG/IMG_Raw.C.

void IMG_Format::removeFormatFromList (  )  [protected]

Specifies if this format can read an image file. One of isReadable() or isWritable() (or both) must return true.

virtual const IMG_Format* IMG_Format::resolvePriority ( const IMG_Format format  )  const [virtual]

Between these two formats, which should be preferred? returns either this or the format parameter. This method is used to resolve conflicts between formats when files are being created.

static bool IMG_Format::setFormatOptionDefault ( const char *  format_name,
const char *  format_option,
const char *  defvalue 
) [static]

Allows you to change an option on a specific format. This will change the option for all formats from this point on, whereas setGlobalOption would not. Returns false if the format or the option couldn't be found.

static void IMG_Format::setGlobalOption ( const char *  name,
const char *  value 
) [static]

Set an option globally for all formats. Use with extreme care.


The documentation for this class was generated from the following file:

Generated on Mon Jan 28 00:29:41 2013 for HDK by  doxygen 1.5.9