Public API Reference

CS::Graphics::UniversalImageConverter Struct Reference

Convert image/texture data between different image/texture formats. More...

#include <csgfx/universalimageconv.h>

List of all members.

Public Types

enum  Result { Success = 0, ErrorIncompatibleComponents = -1, ErrorInvalidFormat = -2, ErrorFormatUnsupported = -3 }

Conversion result.


Static Public Member Functions

static Result ConvertBasic (const void *inputData, const StructuredTextureFormat &inputFormat, void *outputData, const StructuredTextureFormat &outputFormat, size_t numPixels, const void *defaultPixel=nullptr)
 Convert image/texture data between different basic image/texture formats.

Detailed Description

Convert image/texture data between different image/texture formats.

Definition at line 31 of file universalimageconv.h.

Member Enumeration Documentation

Conversion result.


The conversion was successful.


The components in the input and output formats are incompatible (e.g.

a depth format is attempted to be converted to a color format).


The input or output format was invalid.


The input or output format is not supported.

Definition at line 34 of file universalimageconv.h.

Member Function Documentation

static Result CS::Graphics::UniversalImageConverter::ConvertBasic ( const void *  inputData,
const StructuredTextureFormat inputFormat,
void *  outputData,
const StructuredTextureFormat outputFormat,
size_t  numPixels,
const void *  defaultPixel = nullptr 
) [static]

Convert image/texture data between different basic image/texture formats.

Abilities: * Conversion between formats of the same basic component set (RGBA, LA, DS) and conversion from L(A) to RGB(A). * Changing the component sizes (eg convert from rgb8 to r5g6b5 and vice versa). * Converting between float and integer data (eg rgba8 to rgba32_f). If converting from float to integer, values will be clamped to the range 0.0...1.0, and the produced output will be a normalized value (eg when converting to an 8-bit component, the result will be in the component's full range 0...255). Conversely, if converting from integer to float, the integer values are treated as normalized values. * Removing components (eg converting from abgr8 to bgr8, bgr8 to r8) or "adding" them (eg converting from bgr8 to abgr8). Read the documentation to outputData for information about the output values in that case.

Inabilities: * Converting between different component sets (e.g. rgba8 to d32), with the exception of LA to RGBA (e.g. l8 to rgb8). * Replicating components (something like rrr8). * Component sizes larger than 64 bits. * Float widths other than 16, 32 or 64. * Converting to or from any special format whatsoever.

inputData Input pixels buffer.
inputFormat Description of the input data output format.
outputData Output data buffer. Make sure it is large enough to receive the converted output data! Bits for components that appear in the output format, but not the input format, are unchanged; however, they can be set to some known value by providing defaultPixel data.
numPixels Number of pixels to convert.
defaultPixel Optional default output pixel data. Must be in the same format as the outputFormat. Can be used to ensure all components in the output pixels are initialized to a default value.
Conversion result.

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

Generated for Crystal Space 2.1 by doxygen 1.6.1