Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvPNGStreamer Class Reference

Bitmap streamer class. More...

#include <ilviews/bitmaps/png.h>

Inheritance diagram for IlvPNGStreamer:
IlvBitmapStreamer IlvValueInterface

Public Member Functions

 IlvPNGStreamer ()
 Initializes a new IlvPNGStreamer instance.
 
IlBoolean canRead () const
 Indicates that the instance can read from a stream. More...
 
IlBoolean canWrite () const
 Indicates that the instance can write to a stream. More...
 
IlBoolean checkSignature (const IlUChar *data, IlUInt size)
 Checks the signature of the input stream. More...
 
IlUInt getAlphaLevel () const
 Gets the alpha level of the PNG streamer. More...
 
IlUInt getCompressionLevel () const
 Gets the compression level of the generated PNG stream. More...
 
IlUShort getIndexedColors () const
 Returns the number of colors to quantize to. More...
 
IlBoolean hasInterlace () const
 Gets whether the generated PNG stream is interlaced. More...
 
IlBoolean isIndexed () const
 
IlvBitmapDataread (std::istream &stream)
 Reads a PNG image from a stream. More...
 
void setAlphaLevel (IlUInt level)
 Sets the alpha level for the PNG stream. More...
 
void setCompressionLevel (IlUInt level)
 Sets the compression level of the generated PNG stream. More...
 
void setIndexed (IlBoolean indexed, IlUShort numcols=256)
 Sets whether the generated PNG stream is indexed. More...
 
void setInterlace (IlBoolean interlace)
 Sets whether the generated PNG stream is interlaced. More...
 
IlBoolean write (IlvBitmapData *data, std::ostream &stream)
 Writes an IlvBitmapData to a PNG stream with 'TransparencyFromViewsBitmap' mode. More...
 
IlBoolean write (IlvBitmapData *data, std::ostream &stream, IlvPngWriteMethod::IlvPngWriteMethod method)
 Writes an IlvBitmapData to a PNG stream. More...
 
- Public Member Functions inherited from IlvBitmapStreamer
virtual void callReadProgressCallback (IlUInt current, IlUInt max)
 Calls the callback for read progression. More...
 
virtual void callWriteProgressCallback (IlUInt current, IlUInt max)
 Calls the callback for write progression. More...
 
virtual const char * getName () const
 Returns the internal name of the streamer. More...
 
IlvQuantizergetQuantizer () const
 Returns the quantizer used by this streamer. More...
 
virtual IlvBitmapInformationreadInfo (std::istream &stream)
 Reads information from a stream. More...
 
void setQuantizer (IlvQuantizer *quantizer)
 Sets the quantizer used (if needed) by this streamer. More...
 
virtual void setReadProgressCallback (IlvProgressCallback rpCallback, IlAny arg=0)
 Sets the callback for read progression. More...
 
virtual void setWriteProgressCallback (IlvProgressCallback wpCallback, IlAny arg=0)
 Sets the callback for write progression. More...
 
- Public Member Functions inherited from IlvValueInterface
virtual IlBoolean applyValue (const IlvValue &value)
 Apply an accessor. More...
 
virtual IlBoolean changeValue (const IlvValue &val)
 Changes the value of an accessor. More...
 
virtual IlBoolean changeValues (const IlvValue *values, IlUShort count=0)
 Changes several accessor values simultaneously. More...
 
virtual void getAccessors (const IlSymbol *const **names, const IlvValueTypeClass *const **types, IlUInt &count) const
 Retrieves the list of available accessors of an object. More...
 
virtual IlvValuequeryValue (IlvValue &val) const
 Retrieves an accessor value. More...
 
virtual void queryValues (IlvValue *values, IlUShort count) const
 Retrieves multiple accessor values simultaneously. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvBitmapStreamer
static IlvBitmapStreamerGet (const char *name)
 Returns a streamer from its name. More...
 
static IlvBitmapStreamer ** GetRegisteredStreamers (IlUInt &count)
 Returns the registered streamers. More...
 
static IlvBitmapRead (IlvDisplay *display, std::istream &stream, const IlUChar *signature, IlUInt signatureLen)
 Reads a bitmap using the registered streamers. More...
 
static IlvBitmapDataReadBitmapData (std::istream &stream, const IlUChar *signature, IlUInt signatureLen)
 Reads bitmap data using the registered streamers. More...
 
static IlvBitmapInformationReadInfo (std::istream &stream, const IlUChar *signature, IlUInt signatureLen)
 Reads bitmap information using the registered streamers. More...
 
static void Register (IlvBitmapStreamer *streamer)
 Registers the given streamer. More...
 
static IlBoolean UnRegister (IlvBitmapStreamer *streamer)
 Unregisters the given streamer. More...
 

Detailed Description

Bitmap streamer class.

Library: ilvpng

This streamer provides methods to deal with a stream containing a PNG image. It supports reading from all PNG streams. It handles transparent images by mapping alpha values greater than 50 to opaque and others to transparent.
This streamer can read and write.
When writing, it is possible to force indexed output using a specified number of colors. When reading or writing interlaced images, callbacks will be called at each pass. When reading or writing non-interlaced images, callbacks will be called at each scanline.

Member Function Documentation

◆ canRead()

IlBoolean IlvPNGStreamer::canRead ( ) const
virtual

Indicates that the instance can read from a stream.

Returns
IlTrue.

Reimplemented from IlvBitmapStreamer.

◆ canWrite()

IlBoolean IlvPNGStreamer::canWrite ( ) const
virtual

Indicates that the instance can write to a stream.

Returns
IlTrue.

Reimplemented from IlvBitmapStreamer.

◆ checkSignature()

IlBoolean IlvPNGStreamer::checkSignature ( const IlUChar data,
IlUInt  size 
)
virtual

Checks the signature of the input stream.

Parameters
dataThe data containing the signature of the stream.
sizeThe size of the data containing the signature.
Returns
IlTrue if the data contains a PNG signature.

Implements IlvBitmapStreamer.

◆ getAlphaLevel()

IlUInt IlvPNGStreamer::getAlphaLevel ( ) const

Gets the alpha level of the PNG streamer.

Returns
The alpha level.

◆ getCompressionLevel()

IlUInt IlvPNGStreamer::getCompressionLevel ( ) const

Gets the compression level of the generated PNG stream.

Returns
The compression level.

◆ getIndexedColors()

IlUShort IlvPNGStreamer::getIndexedColors ( ) const

Returns the number of colors to quantize to.

Returns
The number of colors.

◆ hasInterlace()

IlBoolean IlvPNGStreamer::hasInterlace ( ) const

Gets whether the generated PNG stream is interlaced.

Returns
IlTrue if the generated PNG stream is interlaced.

◆ isIndexed()

IlBoolean IlvPNGStreamer::isIndexed ( ) const

Gshort Gets whether the generated PNG stream is indexed .

Returns
IlTrue if the generated PNG stream is indexed.

◆ read()

IlvBitmapData* IlvPNGStreamer::read ( std::istream &  stream)
virtual

Reads a PNG image from a stream.

Parameters
streamThe stream to read from.
Returns
An instance of IlvBitmapData.

Reimplemented from IlvBitmapStreamer.

◆ setAlphaLevel()

void IlvPNGStreamer::setAlphaLevel ( IlUInt  level)

Sets the alpha level for the PNG stream.

Alpha levels greater than the given argument are converted to a fully opaque value while alpha levels smaller than the given argument are converted to a fully transparent value.

Parameters
levelThe alpha level.

◆ setCompressionLevel()

void IlvPNGStreamer::setCompressionLevel ( IlUInt  level)

Sets the compression level of the generated PNG stream.

Parameters
levelThe compression level:
  • 0: No compression.
  • 1: Best speed compression
  • 2: Best compression.

◆ setIndexed()

void IlvPNGStreamer::setIndexed ( IlBoolean  indexed,
IlUShort  numcols = 256 
)

Sets whether the generated PNG stream is indexed.

Parameters
indexedIlTrue if the stream is generated in indexed mode.
numcolsThe number of desired colors if quantization is performed.

◆ setInterlace()

void IlvPNGStreamer::setInterlace ( IlBoolean  interlace)

Sets whether the generated PNG stream is interlaced.

Parameters
interlaceIlTrue if the stream is interlaced.

◆ write() [1/2]

IlBoolean IlvPNGStreamer::write ( IlvBitmapData data,
std::ostream &  stream 
)
virtual

Writes an IlvBitmapData to a PNG stream with 'TransparencyFromViewsBitmap' mode.

Parameters
dataThe bitmap data to write.
streamThe stream to write to.
Returns
IlTrue if the bitmap data has been written.

Reimplemented from IlvBitmapStreamer.

◆ write() [2/2]

IlBoolean IlvPNGStreamer::write ( IlvBitmapData data,
std::ostream &  stream,
IlvPngWriteMethod::IlvPngWriteMethod  method 
)

Writes an IlvBitmapData to a PNG stream.

Parameters
dataThe bitmap data to write.
streamThe stream to write to.
IlvPngWriteMethodThe PNG can be written according different methods. See IlvPngWriteMethod for details.
Returns
IlTrue if the bitmap data has been written.