Dali 3D User Interface Engine
Classes | Typedefs | Enumerations | Functions | Variables
Dali::TizenPlatform::anonymous_namespace{image-loader.cpp} Namespace Reference

Classes

struct  BitmapLoader
 Stores the magic bytes, and the loader and header functions used for each image loader. More...
 
struct  FormatExtension
 This code tries to predict the file format from the filename to help with format picking. More...
 

Typedefs

typedef bool(* LoadBitmapFunction )(const ResourceLoadingClient &client, const ImageLoader::Input &input, Integration::Bitmap &bitmap)
 
typedef bool(* LoadBitmapHeaderFunction )(const ImageLoader::Input &input, unsigned int &width, unsigned int &height)
 

Enumerations

enum  FileFormats {
  FORMAT_UNKNOWN = -1, FORMAT_PNG = 0, FORMAT_JPEG, FORMAT_BMP,
  FORMAT_GIF, FORMAT_KTX, FORMAT_ASTC, FORMAT_ICO,
  FORMAT_MAGIC_BYTE_COUNT, FORMAT_WBMP = FORMAT_MAGIC_BYTE_COUNT, FORMAT_TOTAL_COUNT
}
 Enum for file formats, has to be in sync with BITMAP_LOADER_LOOKUP_TABLE. More...
 

Functions

FileFormats GetFormatHint (const std::string &filename)
 
bool GetBitmapLoaderFunctions (FILE *fp, FileFormats format, LoadBitmapFunction &loader, LoadBitmapHeaderFunction &header, Bitmap::Profile &profile)
 Checks the magic bytes of the file first to determine which Image decoder to use to decode the bitmap. More...
 

Variables

const BitmapLoader BITMAP_LOADER_LOOKUP_TABLE [FORMAT_TOTAL_COUNT]
 A lookup table containing all the bitmap loaders with the appropriate information. More...
 
const unsigned int MAGIC_LENGTH = 2
 
const FormatExtension FORMAT_EXTENSIONS []
 
const unsigned int FORMAT_EXTENSIONS_COUNT = sizeof(FORMAT_EXTENSIONS) / sizeof(FormatExtension)
 

Typedef Documentation

typedef bool(* Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::LoadBitmapFunction)(const ResourceLoadingClient &client, const ImageLoader::Input &input, Integration::Bitmap &bitmap)

Definition at line 44 of file image-loader.cpp.

typedef bool(* Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::LoadBitmapHeaderFunction)(const ImageLoader::Input &input, unsigned int &width, unsigned int &height)

Definition at line 45 of file image-loader.cpp.

Enumeration Type Documentation

enum Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::FileFormats

Enum for file formats, has to be in sync with BITMAP_LOADER_LOOKUP_TABLE.

Enumerator
FORMAT_UNKNOWN 
FORMAT_PNG 
FORMAT_JPEG 
FORMAT_BMP 
FORMAT_GIF 
FORMAT_KTX 
FORMAT_ASTC 
FORMAT_ICO 
FORMAT_MAGIC_BYTE_COUNT 
FORMAT_WBMP 
FORMAT_TOTAL_COUNT 

Definition at line 67 of file image-loader.cpp.

Function Documentation

bool Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::GetBitmapLoaderFunctions ( FILE *  fp,
FileFormats  format,
LoadBitmapFunction &  loader,
LoadBitmapHeaderFunction &  header,
Bitmap::Profile profile 
)

Checks the magic bytes of the file first to determine which Image decoder to use to decode the bitmap.

Parameters
[in]fpThe file to decode
[in]formatHint about what format to try first
[out]loaderSet with the function to use to decode the image
[out]headerSet with the function to use to decode the header
[out]profileThe kind of bitmap to hold the bits loaded for the bitmap.
Returns
true, if we can decode the image, false otherwise

Definition at line 156 of file image-loader.cpp.

References BITMAP_LOADER_LOOKUP_TABLE, DALI_LOG_ERROR, FORMAT_MAGIC_BYTE_COUNT, FORMAT_TOTAL_COUNT, FORMAT_UNKNOWN, Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::BitmapLoader::header, height, Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::BitmapLoader::loader, magic, MAGIC_LENGTH, Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::BitmapLoader::magicByte1, Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::BitmapLoader::magicByte2, and Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::BitmapLoader::profile.

Referenced by Dali::TizenPlatform::ImageLoader::ConvertStreamToBitmap(), and Dali::TizenPlatform::ImageLoader::GetClosestImageSize().

Here is the caller graph for this function:

FileFormats Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::GetFormatHint ( const std::string &  filename)

Variable Documentation

const BitmapLoader Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::BITMAP_LOADER_LOOKUP_TABLE[FORMAT_TOTAL_COUNT]
Initial value:
=
{
{ Png::MAGIC_BYTE_1, Png::MAGIC_BYTE_2, LoadBitmapFromPng, LoadPngHeader, Bitmap::BITMAP_2D_PACKED_PIXELS },
{ Bmp::MAGIC_BYTE_1, Bmp::MAGIC_BYTE_2, LoadBitmapFromBmp, LoadBmpHeader, Bitmap::BITMAP_2D_PACKED_PIXELS },
{ Gif::MAGIC_BYTE_1, Gif::MAGIC_BYTE_2, LoadBitmapFromGif, LoadGifHeader, Bitmap::BITMAP_2D_PACKED_PIXELS },
{ Ico::MAGIC_BYTE_1, Ico::MAGIC_BYTE_2, LoadBitmapFromIco, LoadIcoHeader, Bitmap::BITMAP_2D_PACKED_PIXELS },
{ 0x0, 0x0, LoadBitmapFromWbmp, LoadWbmpHeader, Bitmap::BITMAP_2D_PACKED_PIXELS },
}

A lookup table containing all the bitmap loaders with the appropriate information.

Has to be in sync with enum FileFormats

Definition at line 91 of file image-loader.cpp.

Referenced by GetBitmapLoaderFunctions().

const FormatExtension Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::FORMAT_EXTENSIONS[]
Initial value:
=
{
{ ".png", FORMAT_PNG },
{ ".jpg", FORMAT_JPEG },
{ ".bmp", FORMAT_BMP },
{ ".gif", FORMAT_GIF },
{ ".ktx", FORMAT_KTX },
{ ".astc", FORMAT_ASTC },
{ ".ico", FORMAT_ICO },
{ ".wbmp", FORMAT_WBMP }
}

Definition at line 114 of file image-loader.cpp.

const unsigned int Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::FORMAT_EXTENSIONS_COUNT = sizeof(FORMAT_EXTENSIONS) / sizeof(FormatExtension)

Definition at line 126 of file image-loader.cpp.

Referenced by GetFormatHint().

const unsigned int Dali::TizenPlatform::anonymous_namespace{image-loader.cpp}::MAGIC_LENGTH = 2

Definition at line 103 of file image-loader.cpp.

Referenced by GetBitmapLoaderFunctions().

Dali Docs Home
Read more about Dali