Status & Roadmap
Authors & License
Funding U++
Search on this site

SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo



class ImageRaster : public Raster

This class provides the Raster interface to existing Image.



Constructor detail


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.



Public Method List


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.



Constructor detail



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.



Public Method List


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, intprogress = false)

Image LoadFile(const char *fn, const Gate2<int, intprogress = false)

Image LoadString(const String& s, const Gate2<int, intprogress = 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 Tvoid Register()

Registers StreamRaster derived class T.



static One<StreamRasterOpenAny(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, intprogress = false)

static Image LoadFileAny(const char *fn, const Gate2<int, intprogress = 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.



Constructor detail



Puts StreamRaster into error state (error state is reset by Open).



Do you want to contribute?