Classes | Enumerations | Enumerator | Functions
clanDisplay Image Providers

## Classes
class | clan::DDSProvider
| Image provider that can load Direct3D texture (.dds) files. More...
class | clan::ImageProviderFactory
| Image Provider factory. More...
class | clan::ImageProviderType
| Provider type. More...
class | clan::JPEGProvider
| Image provider that can load JPEG (.jpg) files. More...
class | clan::PNGOutputDescription
| Set PNG output options. Used with PNGProvider::save(). More...
class | clan::PNGOutputDescriptionPalette
class | clan::PNGProvider
| Surface provider that can load PNG (.png) files. More...
class | clan::ProviderType_Register< ProviderClass >
| Class template to register a provider type. More...
class | clan::TargaProvider
| Surface provider that can load targa (.tga) files. More...

## Enumerations
enum | clan::PNGColorType { clan::png_color_type_gray, clan::png_color_type_gray_alpha, clan::png_color_type_palette, clan::png_color_type_rgb, clan::png_color_type_rgb_alpha, clan::png_color_mask_palette, clan::png_color_mask_color, clan::png_color_mask_alpha }
enum | clan::PNGFilterMethod { clan::png_filter_type_default, clan::png_intrapixel_differencing }
enum | clan::PNGInterlaceType { clan::png_interlace_none, clan::png_interlace_adam7 }
enum | clan::PNGOffsetUnitType { clan::png_offset_pixel, clan::png_offset_micrometer }
enum | clan::PNGResolutionUnitType { clan::png_resolution_unknown, clan::png_resolution_meter }
enum | clan::PNGsRGBIntent { clan::png_srgb_intent_saturation, clan::png_srgb_intent_perceptual, clan::png_srgb_intent_absolute, clan::png_srgb_intent_relative }
enum | clan::PNGUnknownChunkLocation { clan::png_before_plte, clan::png_before_idat, clan::png_after_idat }

## Functions
| clan::PNGOutputDescriptionPalette::PNGOutputDescriptionPalette ()
void | clan::PNGOutputDescriptionPalette::set_colors (const std::vector< Color > &palette_colors)
void | clan::PNGOutputDescriptionPalette::set_key_color (const Color &color)
void | clan::PNGOutputDescriptionPalette::set_tranparent_color_indexes (const std::vector< int > &alpha_indexes)

## Construction
static PixelBufferSet | clan::DDSProvider::load (const std::string &filename, const FileSystem &file_system)
| Called to load an image with this provider type. More...
static PixelBufferSet | clan::DDSProvider::load (const std::string &fullname)
static PixelBufferSet | clan::DDSProvider::load (IODevice &file)

## Construction
static PixelBuffer | clan::JPEGProvider::load (const std::string &filename, const FileSystem &fs, bool srgb=false)
| Called to load an image with this provider type. More...
static PixelBuffer | clan::JPEGProvider::load (const std::string &fullname, bool srgb=false)
static PixelBuffer | clan::JPEGProvider::load (IODevice &file, bool srgb=false)
static void | clan::JPEGProvider::save (PixelBuffer buffer, const std::string &filename, FileSystem &fs, int quality=85)
| Save the given PixelBuffer into a JPEG. More...
static void | clan::JPEGProvider::save (PixelBuffer buffer, const std::string &fullname, int quality=85)
static void | clan::JPEGProvider::save (PixelBuffer buffer, IODevice &file, int quality=85)

## Construction
| clan::PNGOutputDescription::PNGOutputDescription (int bit_depth=8, PNGColorType color_type=png_color_type_rgb_alpha)
| Create output description. More...

## Operations
void | clan::PNGOutputDescription::add_palette (const PNGOutputDescriptionPalette &palette)
void | clan::PNGOutputDescription::add_comment (const std::string &comment, std::string &keyword, const std::string &lang, const std::string &translated_keyword)
void | clan::PNGOutputDescription::add_unknown_chunk (const std::string &name, const DataBuffer &chunk_data, PNGUnknownChunkLocation location)
void | clan::PNGOutputDescription::set_background_color (const Color &background_color)
void | clan::PNGOutputDescription::set_chromacities (const Vec2f &white, const Vec2f &red, const Vec2f &green, const Vec2f &blue)
void | clan::PNGOutputDescription::set_chromacities_XYZ (const Vec3f &red, const Vec3f &green, const Vec3f &blue)
void | clan::PNGOutputDescription::set_key_color (const Color &color)
void | clan::PNGOutputDescription::set_filter_method (PNGFilterMethod filter)
void | clan::PNGOutputDescription::set_gamma (float gamma)
void | clan::PNGOutputDescription::set_icc_profile (const std::string &profile_name, const DataBuffer &profile_data)
void | clan::PNGOutputDescription::set_interlace_type (PNGInterlaceType type)
void | clan::PNGOutputDescription::set_modification_time (const DateTime &datetime)
void | clan::PNGOutputDescription::set_offset_from_screen_topleft (const Vec2i &offset, PNGOffsetUnitType offset_unit_type)
void | clan::PNGOutputDescription::set_physical_resolution (const Vec2i &resolution, PNGResolutionUnitType resolution_type)
void | clan::PNGOutputDescription::set_physical_scale (int scale_units, const Sized &pixel_size_in_scale_units)
void | clan::PNGOutputDescription::set_srgb_intent (PNGsRGBIntent intent)
void | clan::PNGOutputDescription::set_significant_bits (int num_bits)

## Construction
static PixelBuffer | clan::PNGProvider::load (const std::string &filename, const FileSystem &fs, bool srgb=false)
| Called to load an image with this provider type. More...
static PixelBuffer | clan::PNGProvider::load (const std::string &fullname, bool srgb=false)
static PixelBuffer | clan::PNGProvider::load (IODevice &dev, bool srgb=false)
| Load. More...
static void | clan::PNGProvider::save (PixelBuffer buffer, const std::string &filename, FileSystem &fs)
| Called to save a given PixelBuffer to a file. More...
static void | clan::PNGProvider::save (PixelBuffer buffer, const std::string &fullname)
static void | clan::PNGProvider::save (PixelBuffer buffer, IODevice &iodev)
| Save the given PixelBuffer to an output device. More...

## Operations
static PixelBuffer | clan::ImageProviderFactory::try_load (const std::string &filename, const std::string &type=std::string(), const FileSystem &fs=FileSystem(), std::string *out_failure_reason=nullptr, bool srgb=false)
| Attempts to load an image file from 'filename', using the provider identified by 'type'. More...
static PixelBuffer | clan::ImageProviderFactory::load (const std::string &filename, const FileSystem &fs, const std::string &type=std::string(), bool srgb=false)
| Loads an image file from 'filename', using the provider. More...
static PixelBuffer | clan::ImageProviderFactory::load (const std::string &fullname, const std::string &type=std::string(), bool srgb=false)
static PixelBuffer | clan::ImageProviderFactory::load (IODevice &file, const std::string &type, bool srgb=false)
static void | clan::ImageProviderFactory::save (PixelBuffer buffer, const std::string &filename, FileSystem &fs, const std::string &type=std::string())
| Saves the given PixelBuffer to the file given by 'filename'. More...
static void | clan::ImageProviderFactory::save (PixelBuffer buffer, const std::string &fullname, const std::string &type=std::string())
static void | clan::ImageProviderFactory::save (PixelBuffer buffer, IODevice &file, const std::string &type)

## Construction
| clan::ImageProviderType::ImageProviderType (const std::string &type)
| Registers a provider type in the ImageProviderFactory. More...
virtual | clan::ImageProviderType::~ImageProviderType ()
| Unregisters a provider type in the ImageProviderFactory. More...

## Operations
virtual PixelBuffer | clan::ImageProviderType::load (const std::string &filename, const FileSystem &fs, bool srgb)=0
| Called to load an image with this provider type. More...
virtual PixelBuffer | clan::ImageProviderType::load (IODevice &file, bool srgb)=0
virtual void | clan::ImageProviderType::save (PixelBuffer buffer, const std::string &filename, FileSystem &fs)=0
| Called to save a given PixelBuffer to a file. More...
virtual void | clan::ImageProviderType::save (PixelBuffer buffer, IODevice &file)=0

## Construction
| clan::ProviderType_Register< ProviderClass >::ProviderType_Register (const std::string &type)
| Registers provider type in the ProviderFactory. More...

## Operations
virtual PixelBuffer | clan::ProviderType_Register< ProviderClass >::load (const std::string &filename, const FileSystem &fs, bool srgb) override
| Called to load an image with this provider type. More...
virtual PixelBuffer | clan::ProviderType_Register< ProviderClass >::load (IODevice &file, bool srgb) override
virtual void | clan::ProviderType_Register< ProviderClass >::save (PixelBuffer buffer, const std::string &filename, FileSystem &fs) override
| Called to save a given PixelBuffer to a file. More...
virtual void | clan::ProviderType_Register< ProviderClass >::save (PixelBuffer buffer, IODevice &file) override

## Construction
static PixelBuffer | clan::TargaProvider::load (const std::string &filename, const FileSystem &fs, bool srgb=false)
| Called to load an image with this provider type. More...
static PixelBuffer | clan::TargaProvider::load (const std::string &fullname, bool srgb=false)
static PixelBuffer | clan::TargaProvider::load (IODevice &file, bool srgb=false)
static void | clan::TargaProvider::save (PixelBuffer buffer, const std::string &filename, FileSystem &fs)
static void | clan::TargaProvider::save (PixelBuffer buffer, const std::string &fullname)
static void | clan::TargaProvider::save (PixelBuffer buffer, IODevice &file)

## Detailed Description

## Enumeration Type Documentation

enum clan::PNGColorType

Enumerator
png_color_type_gray |
png_color_type_gray_alpha |
png_color_type_palette |
png_color_type_rgb |
png_color_type_rgb_alpha |
png_color_mask_palette |
png_color_mask_color |
png_color_mask_alpha |

enum clan::PNGFilterMethod

Enumerator
png_filter_type_default |
png_intrapixel_differencing |

enum clan::PNGInterlaceType

Enumerator
png_interlace_none |
png_interlace_adam7 |

enum clan::PNGOffsetUnitType

Enumerator
png_offset_pixel |
png_offset_micrometer |

enum clan::PNGResolutionUnitType

Enumerator
png_resolution_unknown |
png_resolution_meter |

enum clan::PNGsRGBIntent

Enumerator
png_srgb_intent_saturation |
png_srgb_intent_perceptual |
png_srgb_intent_absolute |
png_srgb_intent_relative |

enum clan::PNGUnknownChunkLocation

Enumerator
png_before_plte |
png_before_idat |
png_after_idat |

## Function Documentation

clan::ImageProviderType::ImageProviderType | ( | const std::string & | type | ) |

Registers a provider type in the ImageProviderFactory.

clan::PNGOutputDescription::PNGOutputDescription | ( | int | bit_depth = `8`,
|  | PNGColorType | color_type = `png_color_type_rgb_alpha`
| ) |  |

Create output description.

Parameters

  bit_depth | Number of bits per pixel. valid values are 1, 2, 4, 8, 16 - depending on color_type.
  color_type | Color mode of output image.

clan::PNGOutputDescriptionPalette::PNGOutputDescriptionPalette | ( |  | ) |

template<class ProviderClass >

clan::ProviderType_Register< ProviderClass >::ProviderType_Register | ( | const std::string & | type | ) |
| inline

Registers provider type in the ProviderFactory.

virtual clan::ImageProviderType::~ImageProviderType | ( |  | ) |
| virtual

Unregisters a provider type in the ImageProviderFactory.

void clan::PNGOutputDescription::add_comment | ( | const std::string & | comment,
|  | std::string & | keyword,
|  | const std::string & | lang,
|  | const std::string & | translated_keyword
| ) |  |

void clan::PNGOutputDescription::add_palette | ( | const PNGOutputDescriptionPalette & | palette | ) |

void clan::PNGOutputDescription::add_unknown_chunk | ( | const std::string & | name,
|  | const DataBuffer & | chunk_data,
|  | PNGUnknownChunkLocation | location
| ) |  |

static PixelBufferSet clan::DDSProvider::load | ( | const std::string & | filename,
|  | const FileSystem & | file_system
| ) |  |
| static

Called to load an image with this provider type.

Parameters

  filename | Name of the file to load.
  directory | Directory that file name is relative to.

static PixelBufferSet clan::DDSProvider::load | ( | const std::string & | fullname | ) |
| static

static PixelBuffer clan::PNGProvider::load | ( | const std::string & | filename,
|  | const FileSystem & | fs,
|  | bool | srgb = `false`
| ) |  |
| static

Called to load an image with this provider type.

Parameters

  name | Name of the file to load.
  directory | Directory that file name is relative to.

static PixelBuffer clan::JPEGProvider::load | ( | const std::string & | filename,
|  | const FileSystem & | fs,
|  | bool | srgb = `false`
| ) |  |
| static

Called to load an image with this provider type.

Parameters

  filename | Name of the file to load.
  directory | Directory that file name is relative to.

static PixelBuffer clan::TargaProvider::load | ( | const std::string & | filename,
|  | const FileSystem & | fs,
|  | bool | srgb = `false`
| ) |  |
| static

Called to load an image with this provider type.

Parameters

  name | Name of the file to load.
  directory | Directory that file name is relative to.

static PixelBufferSet clan::DDSProvider::load | ( | IODevice & | file | ) |
| static

static PixelBuffer clan::PNGProvider::load | ( | const std::string & | fullname,
|  | bool | srgb = `false`
| ) |  |
| static

static PixelBuffer clan::JPEGProvider::load | ( | const std::string & | fullname,
|  | bool | srgb = `false`
| ) |  |
| static

static PixelBuffer clan::TargaProvider::load | ( | const std::string & | fullname,
|  | bool | srgb = `false`
| ) |  |
| static

template<class ProviderClass >

virtual PixelBuffer clan::ProviderType_Register< ProviderClass >::load | ( | const std::string & | filename,
|  | const FileSystem & | fs,
|  | bool | srgb
| ) |  |
| inline override virtual

Called to load an image with this provider type.

Implements clan::ImageProviderType.

virtual PixelBuffer clan::ImageProviderType::load | ( | const std::string & | filename,
|  | const FileSystem & | fs,
|  | bool | srgb
| ) |  |
| pure virtual

Called to load an image with this provider type.

Implemented in clan::ProviderType_Register< ProviderClass >.

static PixelBuffer clan::JPEGProvider::load | ( | IODevice & | file,
|  | bool | srgb = `false`
| ) |  |
| static

static PixelBuffer clan::TargaProvider::load | ( | IODevice & | file,
|  | bool | srgb = `false`
| ) |  |
| static

virtual PixelBuffer clan::ImageProviderType::load | ( | IODevice & | file,
|  | bool | srgb
| ) |  |
| pure virtual

Implemented in clan::ProviderType_Register< ProviderClass >.

static PixelBuffer clan::PNGProvider::load | ( | IODevice & | dev,
|  | bool | srgb = `false`
| ) |  |
| static

Load.

Parameters

  dev | = IODevice

Returns
  Pixel Buffer

template<class ProviderClass >

virtual PixelBuffer clan::ProviderType_Register< ProviderClass >::load | ( | IODevice & | file,
|  | bool | srgb
| ) |  |
| inline override virtual

Implements clan::ImageProviderType.

static PixelBuffer clan::ImageProviderFactory::load | ( | const std::string & | filename,
|  | const FileSystem & | fs,
|  | const std::string & | type = `std::string()`,
|  | bool | srgb = `false`
| ) |  |
| static

Loads an image file from 'filename', using the provider.

identified by 'type'.

If the type is an empty string, it uses the extension of the filename to determine what type it is.

The virtual directory will be used as a the source.

static PixelBuffer clan::ImageProviderFactory::load | ( | const std::string & | fullname,
|  | const std::string & | type = `std::string()`,
|  | bool | srgb = `false`
| ) |  |
| static

static PixelBuffer clan::ImageProviderFactory::load | ( | IODevice & | file,
|  | const std::string & | type,
|  | bool | srgb = `false`
| ) |  |
| static

static void clan::TargaProvider::save | ( | PixelBuffer | buffer,
|  | const std::string & | filename,
|  | FileSystem & | fs
| ) |  |
| static

static void clan::PNGProvider::save | ( | PixelBuffer | buffer,
|  | const std::string & | filename,
|  | FileSystem & | fs
| ) |  |
| static

Called to save a given PixelBuffer to a file.

virtual void clan::ImageProviderType::save | ( | PixelBuffer | buffer,
|  | const std::string & | filename,
|  | FileSystem & | fs
| ) |  |
| pure virtual

Called to save a given PixelBuffer to a file.

Implemented in clan::ProviderType_Register< ProviderClass >.

static void clan::TargaProvider::save | ( | PixelBuffer | buffer,
|  | const std::string & | fullname
| ) |  |
| static

static void clan::JPEGProvider::save | ( | PixelBuffer | buffer,
|  | const std::string & | filename,
|  | FileSystem & | fs,
|  | int | quality = `85`
| ) |  |
| static

Save the given PixelBuffer into a JPEG.

Parameters

  buffer | The PixelBuffer to save, format doesn't matter its converted if needed
  filename | File name of JPEG.
  directory | Directory that the file name is relative to.
  quality | The quality level of the JPEG (0-100), 100 being best quality.

static void clan::PNGProvider::save | ( | PixelBuffer | buffer,
|  | const std::string & | fullname
| ) |  |
| static

static void clan::TargaProvider::save | ( | PixelBuffer | buffer,
|  | IODevice & | file
| ) |  |
| static

template<class ProviderClass >

virtual void clan::ProviderType_Register< ProviderClass >::save | ( | PixelBuffer | buffer,
|  | const std::string & | filename,
|  | FileSystem & | fs
| ) |  |
| inline override virtual

Called to save a given PixelBuffer to a file.

Implements clan::ImageProviderType.

virtual void clan::ImageProviderType::save | ( | PixelBuffer | buffer,
|  | IODevice & | file
| ) |  |
| pure virtual

Implemented in clan::ProviderType_Register< ProviderClass >.

static void clan::JPEGProvider::save | ( | PixelBuffer | buffer,
|  | const std::string & | fullname,
|  | int | quality = `85`
| ) |  |
| static

static void clan::PNGProvider::save | ( | PixelBuffer | buffer,
|  | IODevice & | iodev
| ) |  |
| static

Save the given PixelBuffer to an output device.

template<class ProviderClass >

virtual void clan::ProviderType_Register< ProviderClass >::save | ( | PixelBuffer | buffer,
|  | IODevice & | file
| ) |  |
| inline override virtual

Implements clan::ImageProviderType.

static void clan::JPEGProvider::save | ( | PixelBuffer | buffer,
|  | IODevice & | file,
|  | int | quality = `85`
| ) |  |
| static

static void clan::ImageProviderFactory::save | ( | PixelBuffer | buffer,
|  | const std::string & | filename,
|  | FileSystem & | fs,
|  | const std::string & | type = `std::string()`
| ) |  |
| static

Saves the given PixelBuffer to the file given by 'filename'.

If the type is an empty string, it uses the extension of the filename to determine what type it is

static void clan::ImageProviderFactory::save | ( | PixelBuffer | buffer,
|  | const std::string & | fullname,
|  | const std::string & | type = `std::string()`
| ) |  |
| static

static void clan::ImageProviderFactory::save | ( | PixelBuffer | buffer,
|  | IODevice & | file,
|  | const std::string & | type
| ) |  |
| static

void clan::PNGOutputDescription::set_background_color | ( | const Color & | background_color | ) |

void clan::PNGOutputDescription::set_chromacities | ( | const Vec2f & | white,
|  | const Vec2f & | red,
|  | const Vec2f & | green,
|  | const Vec2f & | blue
| ) |  |

void clan::PNGOutputDescription::set_chromacities_XYZ | ( | const Vec3f & | red,
|  | const Vec3f & | green,
|  | const Vec3f & | blue
| ) |  |

void clan::PNGOutputDescriptionPalette::set_colors | ( | const std::vector< Color > & | palette_colors | ) |

void clan::PNGOutputDescription::set_filter_method | ( | PNGFilterMethod | filter | ) |

void clan::PNGOutputDescription::set_gamma | ( | float | gamma | ) |

void clan::PNGOutputDescription::set_icc_profile | ( | const std::string & | profile_name,
|  | const DataBuffer & | profile_data
| ) |  |

void clan::PNGOutputDescription::set_interlace_type | ( | PNGInterlaceType | type | ) |

void clan::PNGOutputDescriptionPalette::set_key_color | ( | const Color & | color | ) |

void clan::PNGOutputDescription::set_key_color | ( | const Color & | color | ) |

void clan::PNGOutputDescription::set_modification_time | ( | const DateTime & | datetime | ) |

void clan::PNGOutputDescription::set_offset_from_screen_topleft | ( | const Vec2i & | offset,
|  | PNGOffsetUnitType | offset_unit_type
| ) |  |

void clan::PNGOutputDescription::set_physical_resolution | ( | const Vec2i & | resolution,
|  | PNGResolutionUnitType | resolution_type
| ) |  |

void clan::PNGOutputDescription::set_physical_scale | ( | int | scale_units,
|  | const Sized & | pixel_size_in_scale_units
| ) |  |

void clan::PNGOutputDescription::set_significant_bits | ( | int | num_bits | ) |

void clan::PNGOutputDescription::set_srgb_intent | ( | PNGsRGBIntent | intent | ) |

void clan::PNGOutputDescriptionPalette::set_tranparent_color_indexes | ( | const std::vector< int > & | alpha_indexes | ) |

static PixelBuffer clan::ImageProviderFactory::try_load | ( | const std::string & | filename,
|  | const std::string & | type = `std::string()`,
|  | const FileSystem & | fs = `FileSystem()`,
|  | std::string * | out_failure_reason = `nullptr`,
|  | bool | srgb = `false`
| ) |  |
| static

Attempts to load an image file from 'filename', using the provider identified by 'type'.

Returns
  If the function fails to load the image, a null pixel buffer object is returned.

If the type is an empty string, it uses the extension of the filename to determine what type it is.

The virtual directory will be used as a the source.