Simple Image Loading LibrarY  0.1.0
Simple Image Loading LibrarY Documentation

The Simple Image Loading LibrarY is a compagnion library of the CEGUI project. This library released under MIT aims at providing a simple and easy to use library for image loading.

At the time being it supports the following image format:

  • Targa
  • JPEG (Joint Photographic Experts Group)
  • Portable Network Graphics

The 0.1.0 release does not support any palettized version.

The library rests on third party library :

In order to help you getting started with the library, the following example shows how to load an image from a memory area. In order to load an image one need to know only a few class : SILLY::MemoryDataSource which is an adaptator around a memory area and SILLY::Image

SILLY::SILLYInit(); // Init the library
SILLY::byte* rawData;
// set rawData with whatever pleased you (an image should be perfect ;p)
// We assume here that rawData is set to a memory area of dataSize bytes.
// Create the data source of the image
SILLY::MemoryDataSource mds(rawData, dataSize);
// You can also use a FileDataSource for the image :
// SILLY::FileDataSource mds(filename);
// Create the image object
SILLY::Image img(mds);
// Load the image header
if (!img.loadImageHeader())
{
// It's an error, the data does not corresponds to an image
// or the image data are not supported by SILLY
// return/exit/abort/throw ...
}
std::cout << "Image Loader: " << img.getLoaderIdentifierString() << std::endl
<< "Width: " << img.getWidth() << std::endl
<< "Height: " << img.getHeight() << std::endl;
// Load the content of the image (pixels)
// Here we want the image data to be stored in memory using
// RGBA and the first line of the image to be stored first
if (!img.loadImageData(SILLY::PF_RGBA, SILLY::PO_TOP_LEFT))
{
// loading of the image data failed
// return/exit/abort/throw
}
// Return a pointer to a byte array containing the
// pixels stored as RGBA
img.getPixelsDataPtr();
// Get the size of the pixel array
img.getPixelsDataSize();
SILLY::SILLYCleanup(); // Free all memory used by the library
SILLY::SILLYCleanup
void SILLYCleanup()
Cleanup SILLY library internal.
Definition: SILLYImageLoaderManager.cpp:100
SILLY::byte
unsigned char byte
Typename for a byte.
Definition: SILLYBase.h:80
SILLY::Image
Image is the main user class of the library.
Definition: SILLYImage.h:73
SILLY::MemoryDataSource
Load an image from a memory area.
Definition: SILLYMemoryDataSource.h:75
SILLY::SILLYInit
bool SILLYInit()
Initialize the SILLY Library.
Definition: SILLYImageLoaderManager.cpp:87