UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ImageCoreDelta.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4ImageCoreUtils.h: Image utility functions.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
11#include "ImageCore.h"
12
13
14
15// FImageViewStrided cannot derive from FImageView
16// you can implicitly convert FImage -> FImageView -> FImageViewStrided
17// but you cannot convert FImageViewStrided -> the others, because they can't have stride
19{
20 void * RawData = nullptr;
22
24
32
34 {
35 *((FImageInfo *)this) = InView; // copy the FImageInfo part
36 RawData = InView.RawData;
37 StrideBytes = InView.GetStrideBytes();
38 }
39
40 // replaces the call in FImageInfo but is NOT virtual ; beware
41 inline int64 GetStrideBytes() const { return StrideBytes; }
42
43 // if IsStrideWidth, then you can convert back to FImageView
44 inline bool IsStrideWidth() const { return StrideBytes == SizeX * GetBytesPerPixel(); }
45
46 // get offset of a pixel from the base pointer, in bytes
47 // replaces the call in FImageInfo but is NOT virtual ; beware
48 inline int64 GetPixelOffsetBytes(int32 X,int32 Y,int32 Slice = 0) const
49 {
50 checkSlow( X >= 0 && X < SizeX );
51 checkSlow( Y >= 0 && Y < SizeY );
52 checkSlow( Slice >= 0 && Slice < NumSlices );
53
54 int64 Offset = Slice * StrideBytes * SizeY;
56 Offset += Y * StrideBytes;
57
58 return Offset;
59 }
60
61 // queries like GetImageSizeBytes are ambiguous ; do you mean the used pixels or the stride?
62
63 inline uint8 * GetRowPointer(int32 Y,int32 Slice = 0) const
64 {
65 checkSlow( Y >= 0 && Y < SizeY );
66 checkSlow( Slice >= 0 && Slice < NumSlices );
67
68 int64 Offset = Slice * StrideBytes * SizeY;
69 Offset += Y * StrideBytes;
70
71 return (uint8 *)RawData + Offset;
72 }
73
74 // get a pointer to a pixel
75 inline void * GetPixelPointer(int32 X,int32 Y,int32 Slice=0) const
76 {
77 uint8 * Ptr = (uint8 *)RawData;
78 Ptr += GetPixelOffsetBytes(X,Y,Slice);
79 return (void *)Ptr;
80 }
81
83 {
86 check( NumSlices == 1 ); // does not support slices
87
88 FImageViewStrided Ret = *this;
89 Ret.SizeX = PortionSizeX;
90 Ret.SizeY = PortionSizeY;
92 return Ret;
93 }
94};
95
96
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
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 X(Name, Desc)
Definition FormatStringSan.h:47
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition ImageCoreDelta.h:98
IMAGECORE_API void DoTransform(const FImageViewStrided &InImage, uint8 *OutData, bool bForward)
Definition ImageCoreDelta.cpp:366
IMAGECORE_API void AddSplitStridedViewsForDelta(TArray64< FImageViewStrided > &OutViews, const FImageView &InView)
Definition ImageCoreDelta.cpp:60
Definition ImageCore.h:139
int32 NumSlices
Definition ImageCore.h:147
int32 SizeY
Definition ImageCore.h:144
int64 GetBytesPerPixel() const
Definition ImageCore.h:195
int32 SizeX
Definition ImageCore.h:141
int64 GetStrideBytes() const
Definition ImageCore.h:223
Definition ImageCoreDelta.h:19
uint8 * GetRowPointer(int32 Y, int32 Slice=0) const
Definition ImageCoreDelta.h:63
const FImageViewStrided GetPortion(int64 PortionStartX, int64 PortionSizeX, int64 PortionStartY, int64 PortionSizeY) const
Definition ImageCoreDelta.h:82
int64 StrideBytes
Definition ImageCoreDelta.h:21
FImageViewStrided(const FImageInfo &InInfo, void *InRawData, int64 InStride=0)
Definition ImageCoreDelta.h:25
bool IsStrideWidth() const
Definition ImageCoreDelta.h:44
int64 GetStrideBytes() const
Definition ImageCoreDelta.h:41
void * GetPixelPointer(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCoreDelta.h:75
FImageViewStrided()
Definition ImageCoreDelta.h:23
int64 GetPixelOffsetBytes(int32 X, int32 Y, int32 Slice=0) const
Definition ImageCoreDelta.h:48
FImageViewStrided(const FImageView &InView)
Definition ImageCoreDelta.h:33
void * RawData
Definition ImageCoreDelta.h:20
Definition ImageCore.h:264