omegalib  13.1
omega::ImageUtils Class Reference

ImageUtils is a container of functions for synchronous and asyncronous image loading. More...

#include <ImageUtils.h>

Classes

struct  LoadImageAsyncTaskData
 

Public Types

enum  ImageFormat { FormatNone, FormatPng, FormatJpeg }
 
typedef AsyncTask< LoadImageAsyncTaskDataLoadImageAsyncTask
 

Static Public Member Functions

static Ref< PixelDataloadImage (const String &filename, bool hasFullPath=false)
 Load an image from a file. More...
 
static bool saveImage (const String &filename, PixelData *data, ImageFormat format)
 Save PixelData to a file with format. More...
 
static Ref< PixelDataloadImageFromStream (std::istream &fin, const String &streamName)
 Load an image from a stream. More...
 
static LoadImageAsyncTaskloadImageAsync (const String &filename, bool hasFullPath=false)
 Load image from a file (async) More...
 
static void loadImagesAsync (const std::list< Ref< LoadImageAsyncTask > > &tasks)
 
static ByteArrayencode (PixelData *data, ImageFormat format)
 Encodes an image using the specified format. Returns a byte array containing the encoded image data. More...
 
static Ref< PixelDatadecode (void *data, size_t size, const String &bufName="<no_name>")
 Load an image from a memory buffer. More...
 
static void internalInitialize ()
 
static void internalDispose ()
 
static void setVerbose (bool value)
 
static void setImageLoaderThreads (int num)
 Sets the number if image loading threads. Must be called before the fist call to loadImageAsync. More...
 
static int getImageLoaderThreads ()
 Gets the number of image loading threads. More...
 
static bool preallocateBlocks (size_t size, int numBlocks)
 Preallocated memory management. More...
 
static size_t getPreallocatedBlockSize ()
 
static int getNumPreallocatedBlocks ()
 
static void * getPreallocatedBlock (int blockIndex)
 
static void setLoadPreallocatedBlock (int blockId)
 Specified which preallocated block to use when loading images. More...
 
static int getLoadPreallocatedBlock ()
 

Detailed Description

ImageUtils is a container of functions for synchronous and asyncronous image loading.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
FormatNone 
FormatPng 
FormatJpeg 

Member Function Documentation

static Ref<PixelData> omega::ImageUtils::decode ( void *  data,
size_t  size,
const String bufName = "<no_name>" 
)
static

Load an image from a memory buffer.

static ByteArray* omega::ImageUtils::encode ( PixelData data,
ImageFormat  format 
)
static

Encodes an image using the specified format. Returns a byte array containing the encoded image data.

static int omega::ImageUtils::getImageLoaderThreads ( )
inlinestatic

Gets the number of image loading threads.

static int omega::ImageUtils::getLoadPreallocatedBlock ( )
inlinestatic
static int omega::ImageUtils::getNumPreallocatedBlocks ( )
static
static void* omega::ImageUtils::getPreallocatedBlock ( int  blockIndex)
static
static size_t omega::ImageUtils::getPreallocatedBlockSize ( )
inlinestatic
static void omega::ImageUtils::internalDispose ( )
static
static void omega::ImageUtils::internalInitialize ( )
static
static Ref<PixelData> omega::ImageUtils::loadImage ( const String filename,
bool  hasFullPath = false 
)
static

Load an image from a file.

static LoadImageAsyncTask* omega::ImageUtils::loadImageAsync ( const String filename,
bool  hasFullPath = false 
)
static

Load image from a file (async)

static Ref<PixelData> omega::ImageUtils::loadImageFromStream ( std::istream &  fin,
const String streamName 
)
static

Load an image from a stream.

static void omega::ImageUtils::loadImagesAsync ( const std::list< Ref< LoadImageAsyncTask > > &  tasks)
static
static bool omega::ImageUtils::preallocateBlocks ( size_t  size,
int  numBlocks 
)
static

Preallocated memory management.

Preallocate memory blocks for image loading and processing.

Returns
true if preallocation succeeded. False otherwise.
static bool omega::ImageUtils::saveImage ( const String filename,
PixelData data,
ImageFormat  format 
)
static

Save PixelData to a file with format.

static void omega::ImageUtils::setImageLoaderThreads ( int  num)
inlinestatic

Sets the number if image loading threads. Must be called before the fist call to loadImageAsync.

static void omega::ImageUtils::setLoadPreallocatedBlock ( int  blockId)
static

Specified which preallocated block to use when loading images.

Pass -1 to disable preallocated block usage on image loading.

static void omega::ImageUtils::setVerbose ( bool  value)
inlinestatic

The documentation for this class was generated from the following file: