UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PngImageWrapper.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "ImageWrapperBase.h"
7
8#if WITH_UNREALPNG
9
11 #include "zlib.h"
12
13 // make sure no other versions of libpng headers are picked up
14#if WITH_LIBPNG_1_6
15 #include "ThirdParty/libPNG/libPNG-1.6.44/png.h"
16 #include "ThirdParty/libPNG/libPNG-1.6.44/pngstruct.h"
17 #include "ThirdParty/libPNG/libPNG-1.6.44/pnginfo.h"
18#else
19 #include "ThirdParty/libPNG/libPNG-1.5.2/png.h"
20 #include "ThirdParty/libPNG/libPNG-1.5.2/pnginfo.h"
21#endif
22
23 #include <setjmp.h>
25
26
37 : public FImageWrapperBase
38{
39public:
40
43
44public:
45
46 //~ FImageWrapper interface
47
48 virtual void Compress(int32 Quality) override;
49 virtual void Reset() override;
50 virtual bool SetCompressed(const void* InCompressedData, int64 InCompressedSize) override;
51 virtual void Uncompress(const ERGBFormat InFormat, int32 InBitDepth) override;
52
53 virtual bool CanSetRawFormat(const ERGBFormat InFormat, const int32 InBitDepth) const override;
55
61 virtual bool SupportsMetadata() const override;
62
69 virtual void AddMetadata(const FString& InKey, const FString& InValue) override;
70
76 virtual void GetMetadata(TStringMap& OutMetadata) const override;
77
78public:
79
85 bool IsPNG() const;
86
92 bool LoadPNGHeader();
93
96
97protected:
98
99 // Callbacks for the pnglibs
105 static void* user_malloc(png_structp png_ptr, png_size_t size);
107
108private:
109
111 int64 ReadOffset;
112
115
118
119#if PLATFORM_ANDROID
120 //Other platforms rely on libPNG internal mechanism to achieve concurrent compression\decompression on multiple threads
123#endif
124
127};
128
129#endif //WITH_UNREALPNG
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define THIRD_PARTY_INCLUDES_START
Definition GenericPlatformCompilerPreSetup.h:63
ERGBFormat
Definition IImageWrapper.h:76
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition ImageWrapperBase.h:17
virtual void Uncompress(const ERGBFormat InFormat, int32 InBitDepth)=0
virtual void Reset()
Definition ImageWrapperBase.cpp:22
virtual bool SetCompressed(const void *InCompressedData, int64 InCompressedSize) override
Definition ImageWrapperBase.cpp:104
virtual bool SupportsMetadata() const override
Definition ImageWrapperBase.cpp:561
virtual void GetMetadata(TStringMap &OutMetadata) const override
Definition ImageWrapperBase.cpp:570
virtual void AddMetadata(const FString &InKey, const FString &InValue) override
Definition ImageWrapperBase.cpp:566
virtual bool CanSetRawFormat(const ERGBFormat InFormat, const int32 InBitDepth) const =0
virtual ERawImageFormat::Type GetSupportedRawFormat(const ERawImageFormat::Type InFormat) const =0
Definition UnrealString.h.inl:34
Type
Definition ImageCore.h:57
Definition Voronoi.cpp:10
const FName Channels("Channels")
Definition NetworkMetricsDefs.h:64