Files
UnrealEngineUWP/Engine/Source/Runtime/ImageWrapper/Public/TgaImageSupport.h
charles bloom 928b53aec3 Tga image importer cleanups and robustination
#preflight yes
#rb fabian.giesen
#rnx

[CL 25774569 by charles bloom in ue5-main branch]
2023-06-02 17:28:34 -04:00

41 lines
1.1 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "HAL/Platform.h"
#include "Serialization/Archive.h"
#pragma pack(push,1)
struct FTGAFileHeader
{
uint8 IdFieldLength;
uint8 ColorMapType;
uint8 ImageTypeCode; // 2 for uncompressed RGB format
uint16 ColorMapOrigin;
uint16 ColorMapLength;
uint8 ColorMapEntrySize;
uint16 XOrigin;
uint16 YOrigin;
uint16 Width;
uint16 Height;
uint8 BitsPerPixel;
uint8 ImageDescriptor;
friend FArchive& operator<<( FArchive& Ar, FTGAFileHeader& H )
{
Ar << H.IdFieldLength << H.ColorMapType << H.ImageTypeCode;
Ar << H.ColorMapOrigin << H.ColorMapLength << H.ColorMapEntrySize;
Ar << H.XOrigin << H.YOrigin << H.Width << H.Height << H.BitsPerPixel;
Ar << H.ImageDescriptor;
return Ar;
}
};
#pragma pack(pop)
/**
* This helper allows to decompress TGA data in a pre-allocated memory block.
* The pixel format is necessarily PF_A8R8G8B8.
*/
IMAGEWRAPPER_API bool DecompressTGA_helper( const FTGAFileHeader* TGA, const int64 TGABufferLength, uint32* TextureData, const int64 TextureDataSize );