Plasma Engine  2.0
Loading...
Searching...
No Matches
plImageConversion Class Reference

Helper class containing utilities to convert between different image formats and layouts. More...

#include <ImageConversion.h>

Classes

struct  ConversionPathNode
 A single node along a computed conversion path. More...
 

Static Public Member Functions

static bool IsConvertible (plImageFormat::Enum sourceFormat, plImageFormat::Enum targetFormat)
 Checks if there is a known conversion path between the two formats.
 
static plImageFormat::Enum FindClosestCompatibleFormat (plImageFormat::Enum format, plArrayPtr< const plImageFormat::Enum > compatibleFormats)
 Finds the image format from a given list of formats which is the cheapest to convert to.
 
static plResult BuildPath (plImageFormat::Enum sourceFormat, plImageFormat::Enum targetFormat, bool bSourceEqualsTarget, plHybridArray< ConversionPathNode, 16 > &ref_path_out, plUInt32 &ref_uiNumScratchBuffers_out)
 Precomputes an optimal conversion path between two formats and the minimal number of required scratch buffers.
 
static plResult Convert (const plImageView &source, plImage &ref_target, plImageFormat::Enum targetFormat)
 Converts the source image into a target image with the given format. Source and target may be the same.
 
static plResult Convert (const plImageView &source, plImage &ref_target, plArrayPtr< ConversionPathNode > path, plUInt32 uiNumScratchBuffers)
 Converts the source image into a target image using a precomputed conversion path.
 
static plResult ConvertRaw (plConstByteBlobPtr source, plByteBlobPtr target, plUInt32 uiNumElements, plImageFormat::Enum sourceFormat, plImageFormat::Enum targetFormat)
 Converts the raw source data into a target data buffer with the given format. Source and target may be the same.
 
static plResult ConvertRaw (plConstByteBlobPtr source, plByteBlobPtr target, plUInt32 uiNumElements, plArrayPtr< ConversionPathNode > path, plUInt32 uiNumScratchBuffers)
 Converts the raw source data into a target data buffer using a precomputed conversion path.
 

Detailed Description

Helper class containing utilities to convert between different image formats and layouts.

Member Function Documentation

◆ BuildPath()

plResult plImageConversion::BuildPath ( plImageFormat::Enum sourceFormat,
plImageFormat::Enum targetFormat,
bool bSourceEqualsTarget,
plHybridArray< ConversionPathNode, 16 > & ref_path_out,
plUInt32 & ref_uiNumScratchBuffers_out )
static

Precomputes an optimal conversion path between two formats and the minimal number of required scratch buffers.

The generated path can be cached by the user if the same conversion is performed multiple times. The path must not be reused if the set of supported conversions changes, e.g. when plugins are loaded or unloaded.

Parameters
sourceFormatThe source format.
targetFormatThe target format.
sourceEqualsTargetIf true, the generated path is applicable if source and target memory regions are equal, and may contain additional copy-steps if the conversion can't be performed in-place. A path generated with sourceEqualsTarget == true will work correctly even if source and target are not the same, but may not be optimal. A path generated with sourceEqualsTarget == false will not work correctly when source and target are the same.
path_outThe generated path.
numScratchBuffers_outThe number of scratch buffers required for the conversion path.
Returns
PL_SUCCESS if a path was found, PL_FAILURE otherwise.

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