Files
UnrealEngineUWP/Engine/Source/Runtime/ImageWrapper/Private/Formats/JpegImageWrapper.h
charles bloom 04ffabc485 ImageWrapper and import/export refactor
FImage is now the standard preferred type for a bag of pixels
FImageView can point at pixels without owning an allocation
ERawImageFormat (FImage) converts to ETextureSourceFormat
FImageUtils provides generic load/save and get/set from FImage
major cleanup in the ImageWrappers
new preferred API is through ImageWrapperModule Compress/Decompress
SetRaw/GetRaw functions cleaned up to not have undefined behavior on unexpected formats
ImageWrapper output added for HDR,BMP,TGA
RGBA32F format added and supported throughout import/export
EditorFactories import/export made more generic, most image types handled the same way using FImage now
Deprecate old TSF RGBA order pixel formats
Fix many crashes or bad handling of unusual pixel formats
Pixel access functions should be used instead of switches on pixel type

#preflight 6230ade7e65a7e65d68a187c
#rb julien.stjean,martins.mozeiko,dan.thompson,fabian.giesen

[CL 19397199 by charles bloom in ue5-main branch]
2022-03-15 18:29:37 -04:00

61 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreTypes.h"
#include "ImageWrapperBase.h"
#if WITH_UNREALJPEG
#if WITH_LIBJPEGTURBO
using tjhandle = void*;
#endif // WITH_LIBJPEGTURBO
/**
* Uncompresses JPEG data to raw 24bit RGB image that can be used by Unreal textures.
*
* Source code for JPEG decompression from http://code.google.com/p/jpeg-compressor/
*/
class FJpegImageWrapper
: public FImageWrapperBase
{
public:
/** Default constructor. */
FJpegImageWrapper(int32 InNumComponents = 4);
#if WITH_LIBJPEGTURBO
virtual ~FJpegImageWrapper();
#endif // WITH_LIBJPEGTURBO
public:
//~ FImageWrapperBase interface
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 void Uncompress(const ERGBFormat InFormat, int32 InBitDepth) override;
virtual void Compress(int32 Quality) override;
virtual bool CanSetRawFormat(const ERGBFormat InFormat, const int32 InBitDepth) const override;
virtual ERawImageFormat::Type GetSupportedRawFormat(const ERawImageFormat::Type InFormat) const override;
private:
int32 NumComponents;
#if WITH_LIBJPEGTURBO
bool SetCompressedTurbo(const void* InCompressedData, int64 InCompressedSize);
void CompressTurbo(int32 Quality);
void UncompressTurbo(const ERGBFormat InFormat, int32 InBitDepth);
#endif // WITH_LIBJPEGTURBO
#if WITH_LIBJPEGTURBO
tjhandle Compressor;
tjhandle Decompressor;
#endif // WITH_LIBJPEGTURBO
};
#endif //WITH_JPEG