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

◆ 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 

◆ PNGFilterMethod

Enumerator
png_filter_type_default 
png_intrapixel_differencing 

◆ PNGInterlaceType

Enumerator
png_interlace_none 
png_interlace_adam7 

◆ PNGOffsetUnitType

Enumerator
png_offset_pixel 
png_offset_micrometer 

◆ PNGResolutionUnitType

Enumerator
png_resolution_unknown 
png_resolution_meter 

◆ PNGsRGBIntent

Enumerator
png_srgb_intent_saturation 
png_srgb_intent_perceptual 
png_srgb_intent_absolute 
png_srgb_intent_relative 

◆ PNGUnknownChunkLocation

Enumerator
png_before_plte 
png_before_idat 
png_after_idat 

Function Documentation

◆ ImageProviderType()

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

Registers a provider type in the ImageProviderFactory.

◆ PNGOutputDescription()

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

Create output description.

Parameters
bit_depthNumber of bits per pixel. valid values are 1, 2, 4, 8, 16 - depending on color_type.
color_typeColor mode of output image.

◆ PNGOutputDescriptionPalette()

clan::PNGOutputDescriptionPalette::PNGOutputDescriptionPalette ( )

◆ ProviderType_Register()

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

Registers provider type in the ProviderFactory.

◆ ~ImageProviderType()

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

Unregisters a provider type in the ImageProviderFactory.

◆ add_comment()

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

◆ add_palette()

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

◆ add_unknown_chunk()

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

◆ load() [1/19]

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

Called to load an image with this provider type.

Parameters
filenameName of the file to load.
directoryDirectory that file name is relative to.

◆ load() [2/19]

template<class ProviderClass >
virtual PixelBuffer clan::ProviderType_Register< ProviderClass >::load ( const std::string &  filename,
const FileSystem fs,
bool  srgb 
)
inlineoverridevirtual

Called to load an image with this provider type.

Implements clan::ImageProviderType.

◆ load() [3/19]

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 >.

◆ load() [4/19]

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
nameName of the file to load.
directoryDirectory that file name is relative to.

◆ load() [5/19]

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
filenameName of the file to load.
directoryDirectory that file name is relative to.

◆ load() [6/19]

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
nameName of the file to load.
directoryDirectory that file name is relative to.

◆ load() [7/19]

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.

◆ load() [8/19]

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

◆ load() [9/19]

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

◆ load() [10/19]

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

◆ load() [11/19]

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

◆ load() [12/19]

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

◆ load() [13/19]

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

Load.

Parameters
dev= IODevice
Returns
Pixel Buffer

◆ load() [14/19]

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

◆ load() [15/19]

template<class ProviderClass >
virtual PixelBuffer clan::ProviderType_Register< ProviderClass >::load ( IODevice file,
bool  srgb 
)
inlineoverridevirtual

◆ load() [16/19]

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

◆ load() [17/19]

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

◆ load() [18/19]

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

◆ load() [19/19]

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

◆ save() [1/16]

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

◆ save() [2/16]

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

Called to save a given PixelBuffer to a file.

◆ save() [3/16]

template<class ProviderClass >
virtual void clan::ProviderType_Register< ProviderClass >::save ( PixelBuffer  buffer,
const std::string &  filename,
FileSystem fs 
)
inlineoverridevirtual

Called to save a given PixelBuffer to a file.

Implements clan::ImageProviderType.

◆ save() [4/16]

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 >.

◆ save() [5/16]

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

◆ save() [6/16]

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
bufferThe PixelBuffer to save, format doesn't matter its converted if needed
filenameFile name of JPEG.
directoryDirectory that the file name is relative to.
qualityThe quality level of the JPEG (0-100), 100 being best quality.

◆ save() [7/16]

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

◆ save() [8/16]

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

◆ save() [9/16]

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

◆ save() [10/16]

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

◆ save() [11/16]

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

◆ save() [12/16]

template<class ProviderClass >
virtual void clan::ProviderType_Register< ProviderClass >::save ( PixelBuffer  buffer,
IODevice file 
)
inlineoverridevirtual

◆ save() [13/16]

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

◆ save() [14/16]

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

◆ save() [15/16]

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

◆ save() [16/16]

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

Save the given PixelBuffer to an output device.

◆ set_background_color()

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

◆ set_chromacities()

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

◆ set_chromacities_XYZ()

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

◆ set_colors()

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

◆ set_filter_method()

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

◆ set_gamma()

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

◆ set_icc_profile()

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

◆ set_interlace_type()

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

◆ set_key_color() [1/2]

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

◆ set_key_color() [2/2]

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

◆ set_modification_time()

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

◆ set_offset_from_screen_topleft()

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

◆ set_physical_resolution()

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

◆ set_physical_scale()

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

◆ set_significant_bits()

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

◆ set_srgb_intent()

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

◆ set_tranparent_color_indexes()

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

◆ try_load()

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.