UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ImageCore.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5/****
6*
7* ImageCore : low level pixel surface types
8*
9* FImage owns an array of pixels
10* FImageView can point at an array of pixels (FImage or otherwise)
11* both have an FImageInfo
12*
13* ERawImageFormat::Type is a pixel format that can be used in FImage (or TextureSource)
14*
15* helpers to load/save/convert FImage are in Engine in FImageUtils
16*
17* ImageCore does not use Engine, only Core
18* it can be used in standalone apps that don't have Engine
19*
20* note to authors: as much as possible, write functions that act on FImageView
21* for example reading and modifying pixels? use FImageView
22* use FImage when you may need to change the format or allocate a new image.
23*
24* prefer using FImage/FImageView instead of TextureSourceFormat or raw arrays or bytes
25*
26* Try not to write code that switches on pixel format, as formats may be added and it creates a fragile maintenance problem.
27*
28*/
29
30
31/* Dependencies
32 *****************************************************************************/
33
35#include "CoreMinimal.h"
36#include "CoreTypes.h"
37#include "Math/Color.h"
38#include "Math/Float16.h"
39#include "Math/Float16Color.h"
40#include "Math/Vector2D.h"
42
43/* Types
44 *****************************************************************************/
45
46 struct FImage;
47
48// EGammaSpace is in Color.h
49
51{
56 enum Type : uint8
57 {
59 BGRA8, // FColor
62 RGBA16F, // FFloat16Color
63 RGBA32F, // FLinearColor
64 G16, // note G8/G16 = gray = replicate to 3 channels, R16F = just in red channel
67 MAX, // used for validation checks < MAX = valid type.
68 Invalid = 0xFF
69 };
70
71 // RGBA -> G8 takes from the *R* channel
72 // G8 -> RGBA replicated to gray
73
75
79
80 // IsU8Channels is not true for BGRE8, it means channels of uint8 in [0,255]
85
86 // Get one pixel of Format type from PixelData and return in Linear color
87 IMAGECORE_API const FLinearColor GetOnePixelLinear(const void * PixelData,Type Format,EGammaSpace Gamma);
88
89 // Get one pixel of Format type from PixelData and return in Linear color
90 inline const FLinearColor GetOnePixelLinear(const void * PixelData,Type Format,bool bSRGB)
91 {
93 }
94
95 // G8 and BGRA8 are affected by Gamma, 16/32 is NOT (they are always Linear)
96 // this happens to be the same as IsU8Channels() at the moment, but don't assume that
98 {
99 if ( Format == G8 || Format == BGRA8 )
100 {
101 return true;
102 }
103 else
104 {
105 // these formats ignore GammaSpace setting, always Linear
106 return false;
107 }
108 }
109
110 // when converting from pixel bags that don't store gamma to FImage
111 // you can use this to guess the gamma they probably wanted
112 // do not use when a real gamma flag is available!
114 {
116 {
117 return EGammaSpace::sRGB;
118 }
119 else
120 {
121 return EGammaSpace::Linear;
122 }
123 }
124};
125
126namespace UE {
127 namespace Color {
129 }
130}
131
139{
142
145
148
151
154
156
165
166 inline bool operator == (const FImageInfo & rhs) const
167 {
168 return
169 SizeX == rhs.SizeX &&
170 SizeY == rhs.SizeY &&
171 NumSlices == rhs.NumSlices &&
172 Format == rhs.Format &&
173 GammaSpace == rhs.GammaSpace;
174 }
175
176 inline bool IsImageInfoValid() const
177 {
178 if ( SizeX < 0 || SizeY < 0 || NumSlices < 0 ) return false;
179 if ( Format == ERawImageFormat::Invalid ) return false;
180 if ( GammaSpace == EGammaSpace::Invalid ) return false;
181 if ( ! GetFormatNeedsGammaSpace(Format) && GammaSpace != EGammaSpace::Linear ) return false;
182 return true;
183 }
184
185 inline bool IsGammaCorrected() const
186 {
188 }
189
195 inline int64 GetBytesPerPixel() const
196 {
198 }
199
200 inline int64 GetNumPixels() const
201 {
202 return (int64) SizeX * SizeY * NumSlices;
203 }
204
206 {
207 return GetNumPixels() * GetBytesPerPixel();
208 }
209
211 {
212 return (int64) SizeX * SizeY;
213 }
214
216 {
218 }
219
220 inline int64 GetWidth() const { return SizeX; }
221 inline int64 GetHeight() const { return SizeY; }
222
223 inline int64 GetStrideBytes() const { return SizeX * GetBytesPerPixel(); }
224
226 {
227 // Gamma is ignored unless GetFormatNeedsGammaSpace, so make sure it is Linear
228 check( GetFormatNeedsGammaSpace(Format) || GammaSpace == EGammaSpace::Linear );
229
230 return GammaSpace;
231 }
232
233 // get offset of a pixel from the base pointer, in bytes
234 inline int64 GetPixelOffsetBytes(int32 X,int32 Y,int32 Slice = 0) const
235 {
236 checkSlow( X >= 0 && X < SizeX );
237 checkSlow( Y >= 0 && Y < SizeY );
238 checkSlow( Slice >= 0 && Slice < NumSlices );
239
240 int64 Offset = Slice * GetSliceNumPixels();
241 Offset += Y * (int64)SizeX;
242 Offset += X;
243 // Offset is now in pixels
245
246 return Offset;
247 }
248
250 // Overwrites the current info with the object's info/
252};
253
254/***
255*
256* Image functions should take an FImageView as input and output to FImage
257*
258* FImageView can point at an FImage or any pixel surface
259*
260* FImage hold allocations. FImageView is non-owning. Make sure the memory pointed at is not freed.
261*
262*/
263struct FImageView : public FImageInfo
264{
265 void * RawData = nullptr;
266
268
272
273 // Make an FImageView pointing at an array of FColor pixels as BGRA8 (does not copy the input, points at it)
283
284 // Make an FImageView pointing at an array of FLinearColor pixels as RGBA32F (does not copy the input, points at it)
294
295 // Make an FImageView pointing at an array of FLinearColor pixels as RGBA16F (does not copy the input, points at it)
305
311
317
318 // get an FImageView to one 2d slice
319 IMAGECORE_API FImageView GetSlice(int32 SliceIndex) const;
320
329
330 // CopyTo same format
332 {
334 }
335
336 // get a pointer to a pixel
337 inline void * GetPixelPointer(int32 X,int32 Y,int32 Slice=0) const
338 {
339 uint8 * Ptr = (uint8 *)RawData;
340 Ptr += GetPixelOffsetBytes(X,Y,Slice);
341 return (void *)Ptr;
342 }
343
344 // Get one pixel from the image and return in Linear color
346 {
347 void * Ptr = GetPixelPointer(X,Y,Slice);
349 }
350
351public:
352
353 // Convenience accessors to raw data
354 // these are const member functions because the FImageView object itself is const, but the image it points to may not be
355
357 {
359 return { (uint8 *)RawData, GetNumPixels() };
360 }
361
363 {
365 return { (uint16*)RawData, GetNumPixels() };
366 }
367
369 {
371 return { (struct FColor*)RawData, GetNumPixels() };
372 }
373
375 {
377 return { (struct FColor*)RawData, GetNumPixels() };
378 }
379
381 {
383 return { (uint16*)RawData, GetNumPixels() * 4 };
384 }
385
391
398
400 {
402 return { (class FFloat16*)RawData, GetNumPixels() };
403 }
404
406 {
408 return { (float *)RawData, GetNumPixels() };
409 }
410};
411
415struct FImage : public FImageInfo
416{
419
420public:
421
426 {
427 }
428
429 FImage(const FImage & CopyFrom) = default;
430 FImage& operator=(const FImage & CopyFrom) = default;
431
432 // move constructor
433 inline FImage(FImage && MoveFrom) : FImageInfo(MoveFrom), RawData(MoveTemp(MoveFrom.RawData))
434 {
435 MoveFrom.Reset();
436 }
437
438 // move assignment
439 FImage& operator=(FImage && MoveFrom)
440 {
441 if (this != &MoveFrom)
442 {
443 Swap(MoveFrom);
444 MoveFrom.Reset();
445 }
446 return *this;
447 }
448
459
460 // note: changed default GammaSpace from Linear to GetDefaultGammaSpace
465
478
479 // note: changed default GammaSpace from Linear to GetDefaultGammaSpace
484
485
486public:
487
488 // Free FImage.RawData
489 // if bAsyncDetached free is done on a Task, not immediately, but the RawData member is empty upon return
490 // note that FreeData does not change the FImageInfo fields, only frees RawData, follow up with Reset() if desired
492
493 // Swap the contents of this FImage with another
494 inline void Swap(FImage & Other)
495 {
496 ::Swap(RawData,Other.RawData);
497 // FImageInfo part be swapped with assignment
498 ::Swap<FImageInfo>(*this,Other); // Templates/UnrealTemplate.h
499 }
500
501 // Reset this FImage to empty default constructed state
502 inline void Reset()
503 {
504 FImage Nada;
505 Swap(Nada);
506 }
507
508 // implicit conversion to FImageView
509 // allows FImage to be passed to functions that take FImageView
510 // functions that read images should use "const FImageView &" as their argument type
511 inline operator FImageView () const
512 {
513 // copy the shared FImageInfo part :
514 const FImageInfo & Info = *this;
515 return FImageView( Info , (void *) RawData.GetData() );
516 }
517
518 // get an FImageView to one 2d slice
519 IMAGECORE_API FImageView GetSlice(int32 SliceIndex) const;
520
529
530 // CopyTo same format
532 {
534 }
535
536 // in-place format change :
537 // does nothing if already in the desired format
539
553
564
565 inline void Linearize(FImage& DestImage) const
566 {
568 }
569
570 UE_DEPRECATED(5.3, "TransformToWorkingColorSpace is deprecated, please use the function in FImageCore.")
572
584
589
600
605
612 IMAGECORE_API void Init(const FImageInfo & Info);
613
614 // get a pointer to a pixel
615 inline void * GetPixelPointer(int32 X,int32 Y,int32 Slice=0) const
616 {
618 return (void *)&RawData[Offset];
619 }
620
621 // Get one pixel from the image and return in Linear color
623 {
624 void * Ptr = GetPixelPointer(X,Y,Slice);
626 }
627
628public:
629
630 // Convenience accessors to raw data
631
633 {
635 return { RawData.GetData(), int64(RawData.Num()) };
636 }
637
639 {
641 return { (uint16*)RawData.GetData(), int64(RawData.Num() / sizeof(uint16)) };
642 }
643
645 {
647 return { (struct FColor*)RawData.GetData(), int64(RawData.Num() / sizeof(FColor)) };
648 }
649
651 {
653 return { (struct FColor*)RawData.GetData(), int64(RawData.Num() / sizeof(FColor)) };
654 }
655
657 {
659 return { (uint16*)RawData.GetData(), int64(RawData.Num() / sizeof(uint16)) };
660 }
661
663 {
665 return { (class FFloat16Color*)RawData.GetData(), int64(RawData.Num() / sizeof(FFloat16Color)) };
666 }
667
669 {
671 return { (struct FLinearColor*)RawData.GetData(), int64(RawData.Num() / sizeof(FLinearColor)) };
672 }
673
675 {
677 return { (class FFloat16*)RawData.GetData(), int64(RawData.Num() / sizeof(FFloat16)) };
678 }
679
681 {
683 return { (float *)RawData.GetData(), int64(RawData.Num() / sizeof(float)) };
684 }
685
686 // Convenience accessors to const raw data
687
689 {
691 return { RawData.GetData(), int64(RawData.Num()) };
692 }
693
695 {
697 return { (const uint16*)RawData.GetData(), int64(RawData.Num() / sizeof(uint16)) };
698 }
699
701 {
703 return { (const struct FColor*)RawData.GetData(), int64(RawData.Num() / sizeof(FColor)) };
704 }
705
707 {
709 return { (struct FColor*)RawData.GetData(), int64(RawData.Num() / sizeof(FColor)) };
710 }
711
713 {
715 return { (const uint16*)RawData.GetData(), int64(RawData.Num() / sizeof(uint16)) };
716 }
717
719 {
721 return { (const class FFloat16Color*)RawData.GetData(), int64(RawData.Num() / sizeof(FFloat16Color)) };
722 }
723
725 {
727 return { (struct FLinearColor*)RawData.GetData(), int64(RawData.Num() / sizeof(FLinearColor)) };
728 }
729
731 {
733 return { (const class FFloat16*)RawData.GetData(), int64(RawData.Num() / sizeof(FFloat16)) };
734 }
735
737 {
739 return { (const float*)RawData.GetData(), int64(RawData.Num() / sizeof(float)) };
740 }
741};
742
746{
747 FSharedImage() = default;
748 virtual ~FSharedImage() = default;
749};
750
755{
756 struct FMipInfo
757 {
760
763
766
769 };
770
773
776
779
782
783public:
791
799
808
813
819
820
821 inline bool IsValid() const
822 {
823 bool bMipInfoValid = true;
824 for (const FMipInfo& MipInfo : SubImages)
825 {
826 bMipInfoValid &= (MipInfo.Width > 0 && MipInfo.Height > 0 && MipInfo.Size > 0);
827 }
828
829 if (!bMipInfoValid) return false;
830 if (Format == ERawImageFormat::Invalid) return false;
831 if (GammaSpace == EGammaSpace::Invalid) return false;
832 if (!GetFormatNeedsGammaSpace(Format) && GammaSpace != EGammaSpace::Linear) return false;
833 return true;
834 }
835
836 inline bool GetMipDimensions(int32 MipLevel, int32& OutWidth, int32& OutHeight) const
837 {
838 if (!SubImages.IsValidIndex(MipLevel))
839 {
840 OutWidth = 0;
841 OutHeight = 0;
842 return false;
843 }
844
845 OutWidth = SubImages[MipLevel].Width;
846 OutHeight = SubImages[MipLevel].Height;
847 return true;
848 }
849
850 inline int32 GetMipCount() const
851 {
852 return SubImages.Num();
853 }
854
856 {
857 check(SubImages.IsValidIndex(MipLevel));
858 return FImageView(static_cast<void*>(RawData.GetData() + SubImages[MipLevel].Offset), SubImages[MipLevel].Width, SubImages[MipLevel].Height, 1, Format, GammaSpace);
859 }
860
862 {
863 FMipInfo MipInfo;
864 {
865 MipInfo.Width = Width;
866 MipInfo.Height = Height;
867 MipInfo.Offset = RawData.Num();
868 MipInfo.Size = Width * Height * ERawImageFormat::GetBytesPerPixel(Format);
869 }
870 SubImages.Add(MipInfo);
871 RawData.Append(MoveTemp(Buffer));
872 }
873
875 {
877 }
878
879};
880
881
882/* Functions
883 *****************************************************************************/
884
886
888
889namespace FImageCore
890{
891
903
913
922
929
930
939
940
948
955
969
979
995
1002
1015
1016
1017 /*
1018 * filter choice for ResizeImage
1019 */
1021 {
1022 Default = 0, // uses a good default filter; = AdaptiveSharp
1024 Box,
1025 Triangle,
1026 Bilinear = Triangle, // synonym
1027 CubicGaussian, // smooth Mitchell B=1,C=0, B-spline, Gaussian-like
1028 CubicSharp, // sharp interpolating cubic, Catmull-Rom (has negative lobes) (Mitchell B=0)
1029 CubicMitchell, // compromise between sharp and smooth cubic, Mitchell-Netrevalli filter with B=1/3, C=1/3 (has negative lobes)
1030 AdaptiveSharp, // sharper adaptive filter; uses CubicSharp for upsample and CubicMitchell for downsample, nop for same size
1031 AdaptiveSmooth, // smoother adaptive filter; uses CubicMitchell for upsample and CubicGaussian for downsample, nop for same size
1032
1033 MitchellOneQuarter, // B=1/4 ("Robidoux")
1034 MitchellOneSixth, // B=1/6
1035 MitchellNegOneSixth, // B=-1/6 , over-sharpening
1036 MitchellNegOneThird, // B=-1/3 , over-sharpening
1037 Lanczos4, // sharp
1038 Lanczos5, // very sharp, often ringy
1039
1040 // cubic Mitchells in order of B: (from highest B to lowest; eg. smoothest to sharpest)
1041 // CubicGaussian // B = 1
1042 // CubicMitchell // B = 1/3
1043 // MitchellOneQuarter // B = 1/4
1044 // MitchellOneSixth // B = 1/6
1045 // CubicSharp // B = 0
1046 // MitchellNegOneSixth // B = -1/6
1047 // MitchellNegOneThird // B = -1/3
1048
1049 WithoutFlagsMask = 63,
1050 Flag_WrapX = 64, // default edge mode is clamp; set these to wrap instead
1051 Flag_WrapY = 128,
1052 Flag_AlphaWeighted = 256 // weight RGB by A in the filter; that is, convert non-premultiplied RGBA input to premultiplied for filtering, then convert back
1053 };
1055
1056 /* ResizeImage :
1057 * DestImage should be already allocated; DestImage will be filled in specified format
1058 * filter is always computed in floating point, gamma correct linear light, but no intermediate conversion is done
1059 * note: some filters (the three "Cubic" options) will change the image even if Source.Size == Dest.Size
1060 * this function can be used to apply filters on same-size image with the Cubic set
1061 * the "Adaptive" (and Default) filters automatically change depending on if the resize is an upsample or downsample, and are nops for same size
1062 *
1063 * @param SourceImage - Source Image to resize from
1064 * @param DestImage - Dest Image to resize to; specifies output size and format. Note the FImageView itself is const but the Dest pixels are written. Dest should be already allocated. Source == Dest in-place resizing not allowed.
1065 * @param Filter - EResizeImageFilter filter choice, or Default if none
1066 */
1068
1069 /* ResizeImage variant. See main ResizeImage function for notes.
1070 *
1071 * Allocate DestImage (if needed) to specified size and Resize from SourceImage into it
1072 * do not use this with Source == Dest (call ResizeImageInPlace)
1073 *
1074 * @param SourceImage - Source Image to resize from
1075 * @param DestImage - Dest to allocated and write to. Will not be allocated if it is already the right size. DestImage size/format is replaced.
1076 * @param DestSizeX - Specifies output of resize. DestImage will be changed to this.
1077 * @param DestSizeY - Specifies output of resize. DestImage will be changed to this.
1078 * @param DestFormat - Specifies output of resize. DestImage will be changed to this.
1079 * @param DestGammaSpace - Specifies output of resize. DestImage will be changed to this.
1080 * @param Filter - EResizeImageFilter filter choice, or Default if none
1081 */
1083
1084 /* ResizeImage variant. See main ResizeImage function for notes.
1085 *
1086 * Allocate DestImage (if needed) to specified size and Resize from SourceImage into it
1087 * do not use this with Source == Dest (call ResizeImageInPlace)
1088 *
1089 * DestImage will have same format as Source
1090 *
1091 * @param SourceImage - Source Image to resize from
1092 * @param DestImage - Dest to allocated and write to. Will not be allocated if it is already the right size. DestImage size/format is replaced.
1093 * @param DestSizeX - Specifies output of resize. DestImage will be changed to this.
1094 * @param DestSizeY - Specifies output of resize. DestImage will be changed to this.
1095 * @param Filter - EResizeImageFilter filter choice, or Default if none
1096 */
1098
1099 /* ResizeImage variant. See main ResizeImage function for notes.
1100 *
1101 * Resize from Image and write the result into Image.
1102 * Image may be reallocated to fit the destination size/format requested.
1103 *
1104 * Other ResizeImage functions do not work in-place.
1105 *
1106 * @param Image - Source Image to resize from, will be changed to hold the destination image and reallocated if needed.
1107 * @param DestSizeX - Specifies output of resize. DestImage will be changed to this.
1108 * @param DestSizeY - Specifies output of resize. DestImage will be changed to this.
1109 * @param DestFormat - Specifies output of resize. DestImage will be changed to this.
1110 * @param DestGammaSpace - Specifies output of resize. DestImage will be changed to this.
1111 * @param Filter - EResizeImageFilter filter choice, or Default if none
1112 */
1114
1115 /* ResizeImage variant. See main ResizeImage function for notes.
1116 *
1117 * Resize from Image and write the result into Image.
1118 * Image may be reallocated to fit the destination size/format requested.
1119 *
1120 * Other ResizeImage functions do not work in-place.
1121 *
1122 * Format of image will not be changed.
1123 *
1124 * @param Image - Source Image to resize from, will be changed to hold the destination image and reallocated if needed.
1125 * @param DestSizeX - Specifies output of resize. DestImage will be changed to this.
1126 * @param DestSizeY - Specifies output of resize. DestImage will be changed to this.
1127 * @param Filter - EResizeImageFilter filter choice, or Default if none
1128 */
1130
1131 //----------------------
1132
1133};
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
EGammaSpace
Definition Color.h:32
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
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 ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
#define X(Name, Desc)
Definition FormatStringSan.h:47
TRefCountPtr< const struct FSharedImage > FSharedImageConstRef
Definition ImageCore.h:744
TRefCountPtr< struct FSharedImage > FSharedImageRef
Definition ImageCore.h:743
IMAGECORE_API int32 ImageParallelForComputeNumJobsForPixels(int64 &OutNumPixelsPerJob, int64 NumPixels)
Definition ImageCore.cpp:123
IMAGECORE_API int32 ImageParallelForComputeNumJobsForRows(int32 &OutNumItemsPerJob, int64 SizeX, int64 SizeY)
Definition ImageCore.cpp:144
void Init()
Definition LockFreeList.h:4
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition CompactBinary.h:1392
Definition Float16Color.h:13
Definition Float16.h:34
Definition RefCounting.h:283
Definition Array.h:670
Definition RefCounting.h:454
Definition ImageCore.h:51
bool GetFormatNeedsGammaSpace(Type Format)
Definition ImageCore.h:97
Type
Definition ImageCore.h:57
@ G8
Definition ImageCore.h:58
@ RGBA32F
Definition ImageCore.h:63
@ RGBA16
Definition ImageCore.h:61
@ R32F
Definition ImageCore.h:66
@ BGRE8
Definition ImageCore.h:60
@ BGRA8
Definition ImageCore.h:59
@ R16F
Definition ImageCore.h:65
@ MAX
Definition ImageCore.h:67
@ G16
Definition ImageCore.h:64
@ Invalid
Definition ImageCore.h:68
@ RGBA16F
Definition ImageCore.h:62
IMAGECORE_API const FUtf8StringView GetNameView(Type Format)
Definition ImageCore.cpp:1358
IMAGECORE_API bool HasAlphaChannel(Type Format)
Definition ImageCore.cpp:1482
IMAGECORE_API bool GetFormatFromString(FUtf8StringView InString, Type &OutFormat)
Definition ImageCore.cpp:1397
IMAGECORE_API int64 GetBytesPerPixel(Type Format)
Definition ImageCore.cpp:1415
IMAGECORE_API const FLinearColor GetOnePixelLinear(const void *PixelData, Type Format, EGammaSpace Gamma)
Definition ImageCore.cpp:1487
IMAGECORE_API int NumChannels(Type Format)
Definition ImageCore.cpp:1452
IMAGECORE_API const TCHAR * GetName(Type Format)
Definition ImageCore.cpp:1378
IMAGECORE_API bool IsU8Channels(Type Format)
Definition ImageCore.cpp:1471
IMAGECORE_API bool IsHDR(Type Format)
Definition ImageCore.cpp:1477
EGammaSpace GetDefaultGammaSpace(Type Format)
Definition ImageCore.h:113
Definition ImageCore.cpp:1836
IMAGECORE_API void ComputeChannelLinearMinMax(const FImageView &InImage, FLinearColor &OutMin, FLinearColor &OutMax)
Definition ImageParallelFor.cpp:356
IMAGECORE_API void TransformToWorkingColorSpace(const FImageView &InLinearImage, const FVector2d &SourceRedChromaticity, const FVector2d &SourceGreenChromaticity, const FVector2d &SourceBlueChromaticity, const FVector2d &SourceWhiteChromaticity, UE::Color::EChromaticAdaptationMethod Method, double EqualityTolerance=1.e-7)
Definition ImageCore.cpp:1745
EResizeImageFilter
Definition ImageCore.h:1021
IMAGECORE_API void ResizeImageInPlace(FImage &Image, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace, EResizeImageFilter Filter=EResizeImageFilter::Default)
Definition ImageCore.cpp:2301
IMAGECORE_API void ResizeTo(const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace)
Definition ImageCore.cpp:1056
IMAGECORE_API FLinearColor ComputeImageLinearAverage(const FImageView &Image)
Definition ImageParallelFor.cpp:82
IMAGECORE_API void TransposeImageRGBABGRA(const FImageView &Image)
Definition ImageCore.cpp:357
IMAGECORE_API void ResizeImageAllocDest(const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace, EResizeImageFilter Filter=EResizeImageFilter::Default)
Definition ImageCore.cpp:2276
IMAGECORE_API bool DetectAlphaChannel(const FImageView &InImage)
Definition ImageCore.cpp:1581
IMAGECORE_API void CopyImage(const FImageView &SrcImage, const FImageView &DestImage)
Definition ImageCore.cpp:369
IMAGECORE_API void SanitizeFloat16AndSetAlphaOpaqueForBC6H(const FImageView &InOutImage)
Definition ImageCore.cpp:1559
IMAGECORE_API bool ScaleChannelsSoMinMaxIsInZeroToOne(const FImageView &ImageToModify)
Definition ImageParallelFor.cpp:536
IMAGECORE_API void SetAlphaOpaque(const FImageView &InImage)
Definition ImageCore.cpp:1733
IMAGECORE_API void ResizeImage(const FImageView &SourceImage, const FImageView &DestImage, EResizeImageFilter Filter=EResizeImageFilter::Default)
Definition ImageCore.cpp:2106
IMAGECORE_API void CopyImageTo2U16(const FImageView &SrcImage, const FImageView &DestImage)
Definition ImageCore.cpp:249
IMAGECORE_API void CopyImageRGBABGRA(const FImageView &SrcImage, const FImageView &DestImage)
Definition ImageCore.cpp:311
EChromaticAdaptationMethod
Definition ColorManagementDefines.h:72
Definition AdvancedWidgetsModule.cpp:13
Definition Color.h:486
Definition ImageCore.h:139
int32 NumSlices
Definition ImageCore.h:147
FImageInfo(int32 InSizeX, int32 InSizeY, int32 InNumSlices, ERawImageFormat::Type InFormat, EGammaSpace InGammaSpace)
Definition ImageCore.h:157
int32 SizeY
Definition ImageCore.h:144
int64 GetBytesPerPixel() const
Definition ImageCore.h:195
bool IsImageInfoValid() const
Definition ImageCore.h:176
int64 GetSliceNumPixels() const
Definition ImageCore.h:210
int64 GetWidth() const
Definition ImageCore.h:220
FImageInfo()
Definition ImageCore.h:155
IMAGECORE_API bool ImageInfoFromCompactBinary(const FCbObject &InObject)
Definition ImageCore.cpp:1792
int64 GetImageSizeBytes() const
Definition ImageCore.h:205
int64 GetSliceSizeBytes() const
Definition ImageCore.h:215
int64 GetNumPixels() const
Definition ImageCore.h:200
bool operator==(const FImageInfo &rhs) const
Definition ImageCore.h:166
int64 GetHeight() const
Definition ImageCore.h:221
bool IsGammaCorrected() const
Definition ImageCore.h:185
int64 GetPixelOffsetBytes(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCore.h:234
int32 SizeX
Definition ImageCore.h:141
ERawImageFormat::Type Format
Definition ImageCore.h:150
IMAGECORE_API void ImageInfoToCompactBinary(class FCbObject &OutObject) const
Definition ImageCore.cpp:1778
EGammaSpace GetGammaSpace() const
Definition ImageCore.h:225
int64 GetStrideBytes() const
Definition ImageCore.h:223
EGammaSpace GammaSpace
Definition ImageCore.h:153
Definition ImageCore.h:264
TArrayView64< FColor > AsBGRA8() const
Definition ImageCore.h:368
FImageView(void *InData, int32 InSizeX, int32 InSizeY, int32 InNumSlices, ERawImageFormat::Type InFormat, EGammaSpace InGammaSpace)
Definition ImageCore.h:306
TArrayView64< uint16 > AsRGBA16() const
Definition ImageCore.h:380
FImageView(const FImageInfo &InInfo, void *InRawData)
Definition ImageCore.h:269
IMAGECORE_API void CopyTo(FImage &DestImage, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace) const
Definition ImageCore.cpp:1033
FImageView(const FLinearColor *InColors, int32 InSizeX, int32 InSizeY)
Definition ImageCore.h:285
FImageView(const FFloat16Color *InColors, int32 InSizeX, int32 InSizeY)
Definition ImageCore.h:296
FImageView(void *InData, int32 InSizeX, int32 InSizeY, ERawImageFormat::Type InFormat)
Definition ImageCore.h:312
void CopyTo(FImage &DestImage) const
Definition ImageCore.h:331
TArrayView64< uint16 > AsG16() const
Definition ImageCore.h:362
TArrayView64< FFloat16 > AsR16F() const
Definition ImageCore.h:399
const FLinearColor GetOnePixelLinear(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCore.h:345
TArrayView64< float > AsR32F() const
Definition ImageCore.h:405
FImageView(const FColor *InColors, int32 InSizeX, int32 InSizeY, EGammaSpace InGammaSpace=EGammaSpace::sRGB)
Definition ImageCore.h:274
FImageView()
Definition ImageCore.h:267
IMAGECORE_API FImageView GetSlice(int32 SliceIndex) const
Definition ImageCore.cpp:1061
TArrayView64< FColor > AsBGRE8() const
Definition ImageCore.h:374
TArrayView64< uint8 > AsG8() const
Definition ImageCore.h:356
TArrayView64< FLinearColor > AsRGBA32F() const
Definition ImageCore.h:392
TArrayView64< FFloat16Color > AsRGBA16F() const
Definition ImageCore.h:386
void * GetPixelPointer(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCore.h:337
void * RawData
Definition ImageCore.h:265
Definition ImageCore.h:416
IMAGECORE_API void ResizeTo(FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace) const
Definition ImageCore.cpp:1050
IMAGECORE_API FImageView GetSlice(int32 SliceIndex) const
Definition ImageCore.cpp:1071
FImage(const FImage &CopyFrom)=default
FImage & operator=(FImage &&MoveFrom)
Definition ImageCore.h:439
IMAGECORE_API void Linearize(uint8 SourceEncoding, FImage &DestImage) const
Definition ImageCore.cpp:1082
TArrayView64< const uint16 > AsRGBA16() const
Definition ImageCore.h:712
TArrayView64< uint8 > AsG8()
Definition ImageCore.h:632
FImage & operator=(const FImage &CopyFrom)=default
TArrayView64< const uint8 > AsG8() const
Definition ImageCore.h:688
TArrayView64< FFloat16 > AsR16F()
Definition ImageCore.h:674
TArray64< uint8 > RawData
Definition ImageCore.h:418
TArrayView64< FFloat16Color > AsRGBA16F()
Definition ImageCore.h:662
void Reset()
Definition ImageCore.h:502
TArrayView64< FLinearColor > AsRGBA32F()
Definition ImageCore.h:668
TArrayView64< float > AsR32F()
Definition ImageCore.h:680
TArrayView64< const FColor > AsBGRE8() const
Definition ImageCore.h:706
void Linearize(FImage &DestImage) const
Definition ImageCore.h:565
void Init(int32 InSizeX, int32 InSizeY, ERawImageFormat::Type InFormat)
Definition ImageCore.h:601
TArrayView64< uint16 > AsG16()
Definition ImageCore.h:638
FImage()
Definition ImageCore.h:425
FImage(FImage &&MoveFrom)
Definition ImageCore.h:433
TArrayView64< uint16 > AsRGBA16()
Definition ImageCore.h:656
const FLinearColor GetOnePixelLinear(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCore.h:622
void Swap(FImage &Other)
Definition ImageCore.h:494
TArrayView64< const FColor > AsBGRA8() const
Definition ImageCore.h:700
TArrayView64< const FLinearColor > AsRGBA32F() const
Definition ImageCore.h:724
FImage(int32 InSizeX, int32 InSizeY, ERawImageFormat::Type InFormat)
Definition ImageCore.h:480
TArrayView64< const uint16 > AsG16() const
Definition ImageCore.h:694
FImage(int32 InSizeX, int32 InSizeY, int32 InNumSlices, ERawImageFormat::Type InFormat)
Definition ImageCore.h:461
IMAGECORE_API void TransformToWorkingColorSpace(const FVector2d &SourceRedChromaticity, const FVector2d &SourceGreenChromaticity, const FVector2d &SourceBlueChromaticity, const FVector2d &SourceWhiteChromaticity, UE::Color::EChromaticAdaptationMethod Method, double EqualityTolerance=1.e-7)
Definition ImageCore.cpp:925
void CopyTo(FImage &DestImage) const
Definition ImageCore.h:531
TArrayView64< const FFloat16Color > AsRGBA16F() const
Definition ImageCore.h:718
FImage(int32 InSizeX, int32 InSizeY, ERawImageFormat::Type InFormat, EGammaSpace InGammaSpace)
Definition ImageCore.h:474
TArrayView64< const float > AsR32F() const
Definition ImageCore.h:736
void * GetPixelPointer(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCore.h:615
TArrayView64< FColor > AsBGRE8()
Definition ImageCore.h:650
TArrayView64< FColor > AsBGRA8()
Definition ImageCore.h:644
TArrayView64< const FFloat16 > AsR16F() const
Definition ImageCore.h:730
IMAGECORE_API void FreeData(bool bAsyncDetached)
Definition ImageCore.cpp:972
IMAGECORE_API void CopyTo(FImage &DestImage, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace) const
Definition ImageCore.cpp:1016
IMAGECORE_API void ChangeFormat(ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace)
Definition ImageCore.cpp:1001
Definition Color.h:48
Definition ImageCore.h:757
int32 Width
Definition ImageCore.h:759
int64 Offset
Definition ImageCore.h:765
int64 Size
Definition ImageCore.h:768
int32 Height
Definition ImageCore.h:762
Definition ImageCore.h:755
void CopyTo(FMipMapImage &DestImage)
Definition ImageCore.h:809
TArray64< uint8 > RawData
Definition ImageCore.h:772
int64 GetNumPixels()
Definition ImageCore.h:874
IMAGECORE_API void CopyTo(FMipMapImage &DestImage, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace)
Definition ImageCore.cpp:1316
IMAGECORE_API void ChangeFormat(ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace)
Definition ImageCore.cpp:1343
bool GetMipDimensions(int32 MipLevel, int32 &OutWidth, int32 &OutHeight) const
Definition ImageCore.h:836
void AddMipImage(TArray64< uint8 > &&Buffer, int32 Width, int32 Height)
Definition ImageCore.h:861
FImageView GetMipImage(int32 MipLevel)
Definition ImageCore.h:855
ERawImageFormat::Type Format
Definition ImageCore.h:778
EGammaSpace GammaSpace
Definition ImageCore.h:781
bool IsValid() const
Definition ImageCore.h:821
TArray< FMipInfo > SubImages
Definition ImageCore.h:775
int32 GetMipCount() const
Definition ImageCore.h:850
Definition ImageCore.h:746
virtual ~FSharedImage()=default
FSharedImage()=default