SILLY

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Revision as of 16:56, 26 February 2011 by Capek (Talk | contribs) (Robot: Adding Category:Uncategorised)

Jump to: navigation, search

Introduction

SILLY means Simple Image Loading LibrarY. The aim of this library is to provide a simple library for loading image in the context of CEGUI. The library supports only the most common image format. The project was initialy launch in order to provide an MIT based replacement of DevIL with less image format supported and focused on loading image only.

Features

  • Image loading from
    • File
    • Memory
  • Supported image format
    • TGA
    • PNG
    • JPG
  • Cross platform
    • Win32
    • Linux
    • OSX (not tested)
  • Image conversion while loading
    • Pixel origine conversion top/bottom left
    • multiple pixel formats
  • License: MIT

Roadmap

0.1.X

  • Initial release

0.2.X

  • Support for more pixel format
  • Better error reporting
  • Debug mode
  • Support all TGA format (even palettized one)
  • Support all PNG format (grayscale and palettized one)
  • Gif support

User Manual

This is a quick manual for using SILLY it is not an intent to replace the API documentation provided by doxygen. This paragraph list some generalities on SILLY and its usage. First all symbol object defined in SILLY are contained in the SILLY namespace. I recommand the use of the complete name each time its needed instead of the using namespace construction. SILLY design make heavly used of the RAII concept and thus you will probably never need to explicitly allocate or release any memory when using SILLY. In order to use SILLY simply #include <SILLY.h>

Installation notes

Windows

When using windows you should use premake to create the solution for MSVC.

Linux

Under linux premake could probably be used as but the prefered method is configure script.

./configure 
make 
make install (as root) 

Initialisation

In order to use SILLY one must initialise the library. This is required in order to load all image loader object in memory. You also have to do some cleanup once you finished using SILLY. You can call several time SILLYInit / SILLYCleanup.

<cpp/> SILLY::SILLYInit(); // Code using SILLY library

SILLY::SILLYCleanup();

DataSource

To load an image you need to tell SILLY where the image data is located. This is the role of the DataSource abstract class. SILLY comes with two implementation of this abstraction. FileDataSource class load an image from a file on disk. The content of the file is loaded in memory in the constructor. You have to check wether the operation succeded using the isValid methode. <cpp/> // Example using SILLY::FileDataSource object SILLY::SILLYInit(); SILLY::FileDataSource source("filename"); if (source.isValid()) {

  // Load the image 

} SILLY::SILLYCleanup();

The second DataSource concrete class is called MemoryDataSource. It provides a wrapper around a previously allocated chunk of memory that is supposed to contain a valid image. A MemoryDataSource object does not need validation because the constructor of the DataSource can't failed. SILLY does not take the ownership of the memory and does not modify this memory. You are responsible of allocating and freeing the memory. <cpp/> // Example using SILLY::MemoryDataSource object SILLY::SILLYInit(); SILLY::MemoryDataSource source(buffer, bufferSize); // Load the image SILLY::SILLYCleanup();

Image class

Extending SILLY

ImageLoader and ImageContext
ImageLoaderManager