class ImageRaster : public Raster
This class provides the Raster interface to existing Image.
ImageRaster(const Image& img)
Creates Raster of img.
class MemoryRaster : public Raster
This class represents an image in specific format stored in memory. It has implicit pick transfer.
void Load(Raster& raster)
Loads raster into MemoryRaster. Keeps the format of source.
int GetLength() const
Returns the number of bytes used to store scanlines of MemoryRaster.
MemoryRaster()
Constructs empty MemoryRaster.
MemoryRaster(Raster& raster)
Loads raster into MemoryRaster. Keeps the format of source.
class StreamRaster : public Raster
Represents an image stored in Stream, usually used as base-class for image decoders, e.g. PNGRaster. StreamRaster derived classes can be registered, in that case a class factory of such class is stored in an array and attempted to load the file of unknown format type.
Stream& GetStream()
Returns the associated Stream.
bool Open(Stream& s)
Associates stream s.with StreamRaster (reference is stored) and calls Create virtual method so that derived class can read the stream header and prepare everything for reading scanlines. If Create signals failure by returning false, put StreamRaster in error state and returns false.
bool IsError()
Returns true if there was any error encountered. Gets reset in Open.
void SetError()
Puts StreamRaster into error state.
Image Load(Stream& s, const Gate2<int, int> progress = false)
Image LoadFile(const char *fn, const Gate2<int, int> progress = false)
Image LoadString(const String& s, const Gate2<int, int> progress = false)
Using Raster virtual methods, loads Image from Stream, file, or string. progress can be used to track the progress and to cancel loading (by returning true).
Registered Decoders and multi-format support
|
|
static template <class T> void Register()
Registers StreamRaster derived class T.
static One<StreamRaster> OpenAny(Stream& s)
Attempts to open the image raster stored in s using all StreamRaster derived classes (decoders) registered by Register (usually, established image file formats like png, gif, bmp are registered). If any decoder is able to open the stream, returns One container with opened decoder, otherwise returned One is empty.
static Image LoadAny(Stream& s, const Gate2<int, int> progress = false)
static Image LoadFileAny(const char *fn, const Gate2<int, int> progress = false)
static Image LoadStringAny(const String& s, const Gate2<int, int> = false)
Attempts to read Image from the stream, file or string, using all registered decoders. progress can be used to track progress of operation or to cancel it by returning true.
StreamRaster()
Puts StreamRaster into error state (error state is reset by Open).
|