UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FImageWrapperBase Class Referenceabstract

#include <ImageWrapperBase.h>

+ Inheritance diagram for FImageWrapperBase:

Public Member Functions

 FImageWrapperBase ()
 
const TArray64< uint8 > & GetRawData () const
 
void MoveRawData (TArray64< uint8 > &OutRawData)
 
virtual void Compress (int32 Quality)=0
 
virtual void Reset ()
 
void SetError (const TCHAR *ErrorMessage)
 
const FString & GetLastError () const
 
virtual void Uncompress (const ERGBFormat InFormat, int32 InBitDepth)=0
 
virtual void Uncompress (const ERGBFormat InFormat, int32 InBitDepth, FDecompressedImageOutput &OutDecompressedImage)
 
virtual TArray64< uint8GetCompressed (int32 Quality=0) override
 
virtual int32 GetBitDepth () const override
 
virtual ERGBFormat GetFormat () const override
 
virtual int64 GetHeight () const override
 
virtual bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, TArray64< uint8 > &OutRawData) override
 
virtual bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, FDecompressedImageOutput &OutDecompressedImage) override
 
virtual int64 GetWidth () const override
 
virtual bool SetCompressed (const void *InCompressedData, int64 InCompressedSize) override
 
virtual bool SetRaw (const void *InRawData, int64 InRawSize, const int32 InWidth, const int32 InHeight, const ERGBFormat InFormat, const int32 InBitDepth, const int32 InBytesPerRow=0) override
 
virtual bool SupportsMetadata () const override
 
virtual void AddMetadata (const FString &InKey, const FString &InValue) override
 
virtual void GetMetadata (TStringMap &OutMetadata) const override
 
- Public Member Functions inherited from IImageWrapper
virtual bool CanSetRawFormat (const ERGBFormat InFormat, const int32 InBitDepth) const =0
 
virtual ERawImageFormat::Type GetSupportedRawFormat (const ERawImageFormat::Type InFormat) const =0
 
virtual TArray64< uint8GetExportData (int32 Quality=0)
 
bool GetRaw (TArray64< uint8 > &OutRawData)
 
bool GetRaw (FDecompressedImageOutput &OutDecompressedImage)
 
bool GetRawImage (FImage &OutImage)
 
bool GetRawImage (FDecompressedImageOutput &OutDecompressedImage)
 
bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, TArray< uint8 > &OutRawData)
 
bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, TArrayView64< uint8 > OutRawData)
 
bool GetSRGB () const
 
ERawImageFormat::Type GetClosestRawImageFormat (bool *bIsExactMatch=nullptr) const
 
void SetDebugImageName (const TCHAR *InDebugImageName)
 
virtual ~IImageWrapper ()
 

Protected Member Functions

int64 GetBytesPerPel () const
 
int64 GetBytesPerRow () const
 
bool GetImageViewOfSetRawForCompress (FImageView &OutImage) const
 

Protected Attributes

TArray64< uint8RawData
 
TArray64< uint8CompressedData
 
ERGBFormat Format
 
int BitDepth
 
int64 Width
 
int64 Height
 
FString LastError
 
- Protected Attributes inherited from IImageWrapper
const TCHARDebugImageName = nullptr
 

Additional Inherited Members

- Public Types inherited from IImageWrapper
using TStringMap = TMap< FString, FString >
 
- Static Public Member Functions inherited from IImageWrapper
static IMAGEWRAPPER_API void ConvertRawImageFormat (ERawImageFormat::Type RawFormat, ERGBFormat &OutFormat, int &OutBitDepth)
 
static IMAGEWRAPPER_API ERawImageFormat::Type ConvertRGBFormat (ERGBFormat RGBFormat, int BitDepth, bool *bIsExactMatch=nullptr)
 
static IMAGEWRAPPER_API int64 GetRGBFormatBytesPerPel (ERGBFormat RGBFormat, int BitDepth)
 

Detailed Description

The abstract helper class for handling the different image formats

Constructor & Destructor Documentation

◆ FImageWrapperBase()

FImageWrapperBase::FImageWrapperBase ( )

Default Constructor.

Member Function Documentation

◆ AddMetadata()

void FImageWrapperBase::AddMetadata ( const FString &  InKey,
const FString &  InValue 
)
overridevirtual

Adds a key and value to this image's metadata. Will be saved in the image's header and restored when the image is loaded.

Parameters
InKeyMetadata consists of key value pairs.
InValueMetadata consists of key value pairs.

Implements IImageWrapper.

◆ Compress()

virtual void FImageWrapperBase::Compress ( int32  Quality)
pure virtual

Compresses the data.

Parameters
QualityThe compression quality.

returns void. call SetError() in your implementation if you fail.

Implemented in FBmpImageWrapper, FDdsImageWrapper, FIcnsImageWrapper, FIcoImageWrapper, and FTgaImageWrapper.

◆ GetBitDepth()

virtual int32 FImageWrapperBase::GetBitDepth ( ) const
inlineoverridevirtual

Gets the bit depth of the image.

Returns
The bit depth per-channel of the image.

Beware several of the old wrappers (BMP,TGA) incorrectly used to return bits per color not per channel they now correctly return per-channel.

Implements IImageWrapper.

◆ GetBytesPerPel()

int64 FImageWrapperBase::GetBytesPerPel ( ) const
inlineprotected

◆ GetBytesPerRow()

int64 FImageWrapperBase::GetBytesPerRow ( ) const
inlineprotected

◆ GetCompressed()

TArray64< uint8 > FImageWrapperBase::GetCompressed ( int32  Quality = 0)
overridevirtual

Gets the compressed data. (call SetRaw first) (Note: It may consume the data set in the SetCompressed function if it was set before)

Returns
Array of the compressed data. returns empty array on failure

Implements IImageWrapper.

◆ GetFormat()

virtual ERGBFormat FImageWrapperBase::GetFormat ( ) const
inlineoverridevirtual

Gets the format of the image. Theoretically, this is the format it would be best to call GetRaw() with, if you support it.

Returns
The format the image data is in

Implements IImageWrapper.

◆ GetHeight()

virtual int64 FImageWrapperBase::GetHeight ( ) const
inlineoverridevirtual

Gets the height of the image.

Returns
Image height.
See also
GetWidth

Implements IImageWrapper.

◆ GetImageViewOfSetRawForCompress()

bool FImageWrapperBase::GetImageViewOfSetRawForCompress ( FImageView OutImage) const
protected

◆ GetLastError()

const FString & FImageWrapperBase::GetLastError ( ) const
inline

Gets last error message.

◆ GetMetadata()

void FImageWrapperBase::GetMetadata ( TStringMap OutMetadata) const
overridevirtual

Copies this image's metadata to the caller's map.

Parameters
OutMetadataA copy of this image's metadata.

Implements IImageWrapper.

◆ GetRaw() [1/2]

bool FImageWrapperBase::GetRaw ( const ERGBFormat  InFormat,
int32  InBitDepth,
FDecompressedImageOutput OutDecompressedImage 
)
overridevirtual

Gets the raw data and meta info (Note: It may consume the data set in the SetRaw function if it was set before)

Parameters
InFormatHow we want to manipulate the RGB data.
InBitDepthThe output bit-depth per channel, normally 8.
OutRawDataWill contain the uncompressed raw data.
OutDecompressedImageWill contain the mip images if available and other metadata.
Returns
true on success, false otherwise.

this is often broken, should only be used with InFormat == GetFormat() DEPRECATED , use GetRaw() with 2 argument or GetRawImage() meta info overload

Implements IImageWrapper.

◆ GetRaw() [2/2]

bool FImageWrapperBase::GetRaw ( const ERGBFormat  InFormat,
int32  InBitDepth,
TArray64< uint8 > &  OutRawData 
)
overridevirtual

Gets the raw data. (Note: It may consume the data set in the SetRaw function if it was set before)

Parameters
InFormatHow we want to manipulate the RGB data.
InBitDepthThe output bit-depth per channel, normally 8.
OutRawDataWill contain the uncompressed raw data.
Returns
true on success, false otherwise.

this is often broken, should only be used with InFormat == GetFormat() DEPRECATED , use GetRaw() with 1 argument or GetRawImage()

Implements IImageWrapper.

Reimplemented in FIcoImageWrapper.

◆ GetRawData()

const TArray64< uint8 > & FImageWrapperBase::GetRawData ( ) const
inline

Gets the image's raw data.

Returns
A read-only byte array containing the data.

◆ GetWidth()

virtual int64 FImageWrapperBase::GetWidth ( ) const
inlineoverridevirtual

Gets the width of the image.

Returns
Image width.
See also
GetHeight

Implements IImageWrapper.

◆ MoveRawData()

void FImageWrapperBase::MoveRawData ( TArray64< uint8 > &  OutRawData)
inline

Moves the image's raw data into the provided array.

Parameters
OutRawDataThe destination array.

◆ Reset()

void FImageWrapperBase::Reset ( )
virtual

Resets the local variables.

Reimplemented in FDdsImageWrapper.

◆ SetCompressed()

bool FImageWrapperBase::SetCompressed ( const void InCompressedData,
int64  InCompressedSize 
)
overridevirtual

Sets the compressed data. Can then call GetRaw().

Parameters
InCompressedDataThe memory address of the start of the compressed data.
InCompressedSizeThe size of the compressed data parsed.
Returns
true if data was the expected format.

after SetCompressed, image info queries like GetWidth and GetBitDepth are allowed call GetRaw to get the decoded bits decompression is not done until GetRaw

Implements IImageWrapper.

Reimplemented in FBmpImageWrapper, FDdsImageWrapper, FIcnsImageWrapper, FIcoImageWrapper, and FTgaImageWrapper.

◆ SetError()

void FImageWrapperBase::SetError ( const TCHAR ErrorMessage)

Sets last error message.

Parameters
ErrorMessageThe error message to set.

◆ SetRaw()

bool FImageWrapperBase::SetRaw ( const void InRawData,
int64  InRawSize,
const int32  InWidth,
const int32  InHeight,
const ERGBFormat  InFormat,
const int32  InBitDepth,
const int32  InBytesPerRow = 0 
)
overridevirtual

Sets the raw image data. Prepares to call GetCompressed() next.

Parameters
InRawDataThe memory address of the start of the raw data.
InRawSizeThe size of the compressed data parsed.
InWidthThe width of the image data.
InHeightthe height of the image data.
InFormatthe format the raw data is in, normally RGBA.
InBitDepththe bit-depth per channel, normally 8.
InBytesPerRowthe number of bytes between rows, 0 = tightly packed rows with no padding.
Returns
true if data was the expected format.

you must not SetRaw() with a format unless it passes CanSetRawFormat() deprecated : avoid direct calls to SetRaw(), use ImageWrapperModule CompressImage instead do not use InBytesPerRow, it is ignored SetRaw does not take gamma information assumes U8 = SRGB and all else = Linear

Implements IImageWrapper.

Reimplemented in FIcnsImageWrapper.

◆ SupportsMetadata()

bool FImageWrapperBase::SupportsMetadata ( ) const
overridevirtual

Does this image type support embedded metadata in its header?

PNG is an example of an image type which supports adding user-defined metadata to its header.

Implements IImageWrapper.

◆ Uncompress() [1/2]

virtual void FImageWrapperBase::Uncompress ( const ERGBFormat  InFormat,
int32  InBitDepth 
)
pure virtual

Function to uncompress our data

Parameters
InFormatHow we want to manipulate the RGB data
InBitDepthThe bit depth per-channel of the image.

returns void. call SetError() in your implementation if you fail.

Implemented in FBmpImageWrapper, FDdsImageWrapper, FIcnsImageWrapper, FIcoImageWrapper, and FTgaImageWrapper.

◆ Uncompress() [2/2]

void FImageWrapperBase::Uncompress ( const ERGBFormat  InFormat,
int32  InBitDepth,
FDecompressedImageOutput OutDecompressedImage 
)
virtual

Function to uncompress our data and retrive meta info along with it.

Parameters
InFormatHow we want to manipulate the RGB data
InBitDepthThe bit depth per-channel of the image.
OutDecompressedImageHolds decompressed image, its mip-maps if available along with meta data that can be retrived during the decompression of the image.

returns void. call SetError() in your implementation if you fail.

Member Data Documentation

◆ BitDepth

int FImageWrapperBase::BitDepth
protected

◆ CompressedData

TArray64<uint8> FImageWrapperBase::CompressedData
protected

◆ Format

ERGBFormat FImageWrapperBase::Format
protected

Format of the raw data

◆ Height

int64 FImageWrapperBase::Height
protected

◆ LastError

FString FImageWrapperBase::LastError
protected

Last Error Message.

◆ RawData

TArray64<uint8> FImageWrapperBase::RawData
protected

Arrays of compressed/raw data

◆ Width

int64 FImageWrapperBase::Width
protected

Width/Height of the image data


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