UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Color.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
7#include "CoreTypes.h"
9#include "Math/MathFwd.h"
12#include "Misc/Crc.h"
13#include "Misc/Parse.h"
19
20class FFloat16Color;
24class FSHA1;
25struct FColor;
26template <typename T> struct TIsPODType;
27
31enum class EGammaSpace : uint8
32{
34 Linear,
36 Pow22,
38 sRGB,
39
41};
42
43
48{
49 union
50 {
51 struct
52 {
53 float R,
57 };
58
59 UE_DEPRECATED(all, "For internal use only.")
61 };
62
65
68
69 FLinearColor() = default;
71 : R(0), G(0), B(0), A(0)
72 {}
73 constexpr UE_FORCEINLINE_HINT FLinearColor(float InR,float InG,float InB,float InA = 1.0f): R(InR), G(InG), B(InB), A(InA) {}
74
81
83 CORE_API explicit FLinearColor(const FVector3d& Vector); // Warning: keep this explicit, or FVector4f will be implicitly created from FVector3d via FLinearColor
84
86 CORE_API explicit FLinearColor(const FVector4d& Vector); // Warning: keep this explicit, or FVector4f will be implicitly created from FVector4d via FLinearColor
87
88 // use Float16Color::GetFloats() directly
89 CORE_API explicit FLinearColor(const FFloat16Color& C);
90
91 // Serializer.
92
94 {
95 return Ar << Color.R << Color.G << Color.B << Color.A;
96 }
97
98 bool Serialize( FArchive& Ar )
99 {
100 Ar << *this;
101 return true;
102 }
103
105 {
107 Record << SA_VALUE(TEXT("R"), Color.R) << SA_VALUE(TEXT("G"), Color.G) << SA_VALUE(TEXT("B"), Color.B) << SA_VALUE(TEXT("A"), Color.A);
108 }
109
111 {
112 Slot << *this;
113 return true;
114 }
115
116 // Conversions.
117 [[nodiscard]] CORE_API FColor ToRGBE() const;
118
127
133
134 // Operators.
135
142
149
150 [[nodiscard]] inline FLinearColor operator+(const FLinearColor& ColorB) const
151 {
152 return FLinearColor(
153 this->R + ColorB.R,
154 this->G + ColorB.G,
155 this->B + ColorB.B,
156 this->A + ColorB.A
157 );
158 }
159 inline FLinearColor& operator+=(const FLinearColor& ColorB)
160 {
161 R += ColorB.R;
162 G += ColorB.G;
163 B += ColorB.B;
164 A += ColorB.A;
165 return *this;
166 }
167
168 [[nodiscard]] inline FLinearColor operator-(const FLinearColor& ColorB) const
169 {
170 return FLinearColor(
171 this->R - ColorB.R,
172 this->G - ColorB.G,
173 this->B - ColorB.B,
174 this->A - ColorB.A
175 );
176 }
177 inline FLinearColor& operator-=(const FLinearColor& ColorB)
178 {
179 R -= ColorB.R;
180 G -= ColorB.G;
181 B -= ColorB.B;
182 A -= ColorB.A;
183 return *this;
184 }
185
186 [[nodiscard]] inline FLinearColor operator*(const FLinearColor& ColorB) const
187 {
188 return FLinearColor(
189 this->R * ColorB.R,
190 this->G * ColorB.G,
191 this->B * ColorB.B,
192 this->A * ColorB.A
193 );
194 }
195 inline FLinearColor& operator*=(const FLinearColor& ColorB)
196 {
197 R *= ColorB.R;
198 G *= ColorB.G;
199 B *= ColorB.B;
200 A *= ColorB.A;
201 return *this;
202 }
203
204 [[nodiscard]] inline FLinearColor operator*(float Scalar) const
205 {
206 return FLinearColor(
207 this->R * Scalar,
208 this->G * Scalar,
209 this->B * Scalar,
210 this->A * Scalar
211 );
212 }
213
215 {
216 R *= Scalar;
217 G *= Scalar;
218 B *= Scalar;
219 A *= Scalar;
220 return *this;
221 }
222
223 [[nodiscard]] inline FLinearColor operator/(const FLinearColor& ColorB) const
224 {
225 return FLinearColor(
226 this->R / ColorB.R,
227 this->G / ColorB.G,
228 this->B / ColorB.B,
229 this->A / ColorB.A
230 );
231 }
232 inline FLinearColor& operator/=(const FLinearColor& ColorB)
233 {
234 R /= ColorB.R;
235 G /= ColorB.G;
236 B /= ColorB.B;
237 A /= ColorB.A;
238 return *this;
239 }
240
241 [[nodiscard]] inline FLinearColor operator/(float Scalar) const
242 {
243 const float InvScalar = 1.0f / Scalar;
244 return FLinearColor(
245 this->R * InvScalar,
246 this->G * InvScalar,
247 this->B * InvScalar,
248 this->A * InvScalar
249 );
250 }
252 {
253 const float InvScalar = 1.0f / Scalar;
254 R *= InvScalar;
255 G *= InvScalar;
256 B *= InvScalar;
257 A *= InvScalar;
258 return *this;
259 }
260
261 // clamped in 0..1 range
262 [[nodiscard]] inline FLinearColor GetClamped(float InMin = 0.0f, float InMax = 1.0f) const
263 {
264 FLinearColor Ret;
265
266 Ret.R = FMath::Clamp(R, InMin, InMax);
267 Ret.G = FMath::Clamp(G, InMin, InMax);
268 Ret.B = FMath::Clamp(B, InMin, InMax);
269 Ret.A = FMath::Clamp(A, InMin, InMax);
270
271 return Ret;
272 }
273
276 {
277 return this->R == ColorB.R && this->G == ColorB.G && this->B == ColorB.B && this->A == ColorB.A;
278 }
280 {
281 return this->R != Other.R || this->G != Other.G || this->B != Other.B || this->A != Other.A;
282 }
283
284 // Error-tolerant comparison.
285 [[nodiscard]] UE_FORCEINLINE_HINT bool Equals(const FLinearColor& ColorB, float Tolerance=UE_KINDA_SMALL_NUMBER) const
286 {
287 return FMath::Abs(this->R - ColorB.R) < Tolerance && FMath::Abs(this->G - ColorB.G) < Tolerance && FMath::Abs(this->B - ColorB.B) < Tolerance && FMath::Abs(this->A - ColorB.A) < Tolerance;
288 }
289
291 {
292 FLinearColor NewCopy = *this;
293 NewCopy.A = NewOpacity;
294 return NewCopy;
295 }
296
301
306
311
316
320 [[nodiscard]] static inline float Dist( const FLinearColor &V1, const FLinearColor &V2 )
321 {
322 return FMath::Sqrt( FMath::Square(V2.R-V1.R) + FMath::Square(V2.G-V1.G) + FMath::Square(V2.B-V1.B) + FMath::Square(V2.A-V1.A) );
323 }
324
334
337
340
351 [[nodiscard]] static CORE_API FLinearColor LerpUsingHSV( const FLinearColor& From, const FLinearColor& To, const float Progress );
352
357 [[nodiscard]] inline FColor QuantizeRound() const;
358
364 [[nodiscard]] inline FColor QuantizeFloor() const;
365
371
372 [[nodiscard]] inline FColor ToFColor(const bool bSRGB) const;
373
381
383 [[nodiscard]] CORE_API float GetLuminance() const;
384
391 {
392 return FMath::Max( FMath::Max( FMath::Max( R, G ), B ), A );
393 }
394
396 [[nodiscard]] bool IsAlmostBlack() const
397 {
399 }
400
407 {
408 return FMath::Min( FMath::Min( FMath::Min( R, G ), B ), A );
409 }
410
411 [[nodiscard]] CORE_API FString ToString() const;
412
420 CORE_API bool InitFromString( const FString& InSourceString );
421
429 [[nodiscard]] static inline float Clamp01NansTo0(float InValue)
430 {
431 // Write this explicitly instead of using FMath::Clamp because we're particular
432 // about what happens with NaNs here.
433 const float ClampedLo = (InValue > 0.0f) ? InValue : 0.0f; // Also turns NaNs into 0.
434 return (ClampedLo < 1.0f) ? ClampedLo : 1.0f;
435 }
436
446 const int32 Seed,
447 const float Saturation=1.f,
448 const float Value=1.f,
449 const float HueRotation=180.f)
450 {
451 constexpr float GoldenRatio = 1.618033988749895f; // (1 + FMath::Sqrt(5.f)) / 2.f;
452 return FLinearColor(static_cast<float>(Seed) * GoldenRatio * HueRotation, Saturation, Value).HSVToLinearRGB();
453 }
454
455 // Common colors.
464
466 {
467 // Note: this assumes there's no padding in FLinearColor that could contain uncompared data.
469 }
470};
472
474{
475 return Color.operator*( Scalar );
476}
477
478//
479// FColor
480// Stores a color with 8 bits of precision per channel.
481// Note: Linear color values should always be converted to gamma space before stored in an FColor, as 8 bits of precision is not enough to store linear space colors!
482// This can be done with FLinearColor::ToFColor(true)
483//
484
485struct FColor
486{
487public:
488 // Variables.
489#if PLATFORM_LITTLE_ENDIAN
490 union { struct{ uint8 B,G,R,A; }; uint32 Bits; };
491#else // PLATFORM_LITTLE_ENDIAN
492 union { struct{ uint8 A,R,G,B; }; uint32 Bits; };
493#endif
494
495 uint32& DWColor(void) {return Bits;}
496 const uint32& DWColor(void) const {return Bits;}
497
498 // Constructors.
499 FColor() = default;
501 {
502 // put these into the body for proper ordering with INTEL vs non-INTEL_BYTE_ORDER
503 R = G = B = A = 0;
504 }
505 constexpr inline FColor( uint8 InR, uint8 InG, uint8 InB, uint8 InA = 255 )
506 // put these into the body for proper ordering with INTEL vs non-INTEL_BYTE_ORDER
507#if PLATFORM_LITTLE_ENDIAN
508 : B(InB), G(InG), R(InR), A(InA)
509#else
510 : A(InA), R(InR), G(InG), B(InB)
511#endif
512 {}
513
515 {
516 DWColor() = InColor;
517 }
518
519 // Serializer.
521 {
522 return Ar << Color.DWColor();
523 }
524
525 bool Serialize( FArchive& Ar )
526 {
527 Ar << *this;
528 return true;
529 }
530
531 // Serializer.
533 {
534 return Slot << Color.DWColor();
535 }
536
538 {
539 Slot << *this;
540 return true;
541 }
542
543 // Operators.
545 {
546 return DWColor() == C.DWColor();
547 }
548
550 {
551 return DWColor() != C.DWColor();
552 }
553
554 inline void operator+=(const FColor& C)
555 {
556 R = (uint8) FMath::Min((int32) R + (int32) C.R,255);
557 G = (uint8) FMath::Min((int32) G + (int32) C.G,255);
558 B = (uint8) FMath::Min((int32) B + (int32) C.B,255);
559 A = (uint8) FMath::Min((int32) A + (int32) C.A,255);
560 }
561
562 [[nodiscard]] CORE_API FLinearColor FromRGBE() const;
563
573 [[nodiscard]] static CORE_API FColor FromHex( const FString& HexString );
574
578 [[nodiscard]] static CORE_API FColor MakeRandomColor();
579
583 [[nodiscard]] static CORE_API FColor MakeRedToGreenColorFromScalar(float Scalar);
584
588 [[nodiscard]] static CORE_API FColor MakeFromColorTemperature( float Temp );
589
593 [[nodiscard]] static CORE_API FColor MakeRandomSeededColor(int32 Seed);
594
601 {
602 return (uint8)( 0.5f + FLinearColor::Clamp01NansTo0(UnitFloat) * 255.f );
603 }
604
606 {
607 return (uint16)( 0.5f + FLinearColor::Clamp01NansTo0(UnitFloat) * 65535.f );
608 }
609
611 {
612 check( Value8 >= 0 && Value8 <= 255 );
613
614 return (float)Value8 * (1.f/255.f);
615 }
618 {
619 check( Value16 >= 0 && Value16 <= 65535 );
620
621 return (float)Value16 * (1.f/65535.f);
622 }
623
625 {
626 check( Value10 >= 0 && Value10 <= 1023 );
627
628 // Dequantize from 10 bit (Value10/1023.f)
629 // requantize to 8 bit with rounding (GPU convention UNorm)
630 // this is the computation we want :
631 // (int)( (Value10/1023.f)*255.f + 0.5f );
632 // this gives the exactly the same results :
633 int Temp = Value10*255 + (1<<9);
634 int Value8 = (Temp + (Temp >> 10)) >> 10;
635 return (uint8)Value8;
636 }
637
639 {
640 check( Value16 >= 0 && Value16 <= 65535 );
641
642 // Dequantize x from 16 bit (Value16/65535.f)
643 // then requantize to 8 bit with rounding (GPU convention UNorm)
644
645 // matches exactly with :
646 // (int)( (Value16/65535.f) * 255.f + 0.5f );
647 int Value8 = (Value16*255 + 32895)>>16;
648 return (uint8)Value8;
649 }
650
654 [[nodiscard]] static FColor MakeRequantizeFrom1010102( int R, int G, int B, int A )
656 check( A >= 0 && A <= 3 );
657
658 // requantize 2 bits to 8 ; could bit-replicate or just table lookup :
659 const uint8 Requantize2to8[4] = { 0, 0x55, 0xAA, 0xFF };
660 return FColor(
661 Requantize10to8(R),
662 Requantize10to8(G),
663 Requantize10to8(B),
664 Requantize2to8[A] );
665
666 }
667
673 {
674 return FColor( R, G, B, Alpha );
675 }
676
684 {
685 constexpr float inv255 = 1.f / 255.f;
686 return FLinearColor(R * inv255, G * inv255, B * inv255, A * inv255);
687 }
688
697 [[nodiscard]] CORE_API FString ToHex() const;
698
705 [[nodiscard]] CORE_API FString ToString() const;
706
714 CORE_API bool InitFromString( const FString& InSourceString );
715
720 {
721 return ( A << 24 ) | ( R << 16 ) | ( G << 8 ) | ( B << 0 );
722 }
723
728 {
729 return ( A << 24 ) | ( B << 16 ) | ( G << 8 ) | ( R << 0 );
730 }
731
736 {
737 return ( R << 24 ) | ( G << 16 ) | ( B << 8 ) | ( A << 0 );
738 }
739
744 {
745 return ( B << 24 ) | ( G << 16 ) | ( R << 8 ) | ( A << 0 );
746 }
747
749 static CORE_API const FColor White;
750 static CORE_API const FColor Black;
752 static CORE_API const FColor Red;
753 static CORE_API const FColor Green;
754 static CORE_API const FColor Blue;
755 static CORE_API const FColor Yellow;
756 static CORE_API const FColor Cyan;
757 static CORE_API const FColor Magenta;
758 static CORE_API const FColor Orange;
759 static CORE_API const FColor Purple;
761 static CORE_API const FColor Silver;
762 static CORE_API const FColor Emerald;
763
765 {
766 return Color.DWColor();
767 }
768
769private:
777 explicit FColor(const FLinearColor& LinearColor);
778};
780
788
790{
791 // Avoid FMath::RoundToInt because it calls floor()
792 return FColor(
793 (uint8)(0.5f + Clamp01NansTo0(R) * 255.f),
794 (uint8)(0.5f + Clamp01NansTo0(G) * 255.f),
795 (uint8)(0.5f + Clamp01NansTo0(B) * 255.f),
796 (uint8)(0.5f + Clamp01NansTo0(A) * 255.f)
797 );
798}
799
801{
802 return FColor(
803 (uint8)(Clamp01NansTo0(R) * 255.f),
804 (uint8)(Clamp01NansTo0(G) * 255.f),
805 (uint8)(Clamp01NansTo0(B) * 255.f),
806 (uint8)(Clamp01NansTo0(A) * 255.f)
807 );
808}
809
810inline FColor FLinearColor::ToFColor(const bool bSRGB) const
811{
812 if ( bSRGB )
813 {
814 return ToFColorSRGB();
815 }
816 else
817 {
818 return QuantizeRound();
819 }
820}
821
822
825
828
829// These act like a POD
830template <> struct TIsPODType<FColor> { enum { Value = true }; };
831template <> struct TIsPODType<FLinearColor> { enum { Value = true }; };
832
833
837struct UE_DEPRECATED(5.7, "FDXTColor565 is deprecated, manipulate DXT blocks directly as required") FDXTColor565
838{
840 uint16 B:5;
841
843 uint16 G:6;
844
846 uint16 R:5;
847};
848
849
853struct UE_DEPRECATED(5.7, "FDXTColor16 is deprecated, manipulate DXT blocks directly as required") FDXTColor16
854{
856 union
857 {
862 };
864};
865
866
870struct UE_DEPRECATED(5.7, "FDXT1 is deprecated, manipulate DXT blocks directly as required") FDXT1
871{
874 union
875 {
877 uint32 Colors;
878 };
881 uint32 Indices;
882};
883
884
888struct UE_DEPRECATED(5.7, "FDXT5 is deprecated, manipulate DXT blocks directly as required") FDXT5
889{
891 uint8 Alpha[8];
894 FDXT1 DXT1;
896};
897
899
900// Make DXT helpers act like PODs
901template <> struct TIsPODType<FDXT1> { enum { Value = true }; };
902template <> struct TIsPODType<FDXT5> { enum { Value = true }; };
903template <> struct TIsPODType<FDXTColor16> { enum { Value = true }; };
904template <> struct TIsPODType<FDXTColor565> { enum { Value = true }; };
905
#define check(expr)
Definition AssertionMacros.h:314
CORE_API void ComputeAndFixedColorAndIntensity(const FLinearColor &InLinearColor, FColor &OutColor, float &OutIntensity)
Definition Color.cpp:603
EGammaSpace
Definition Color.h:32
CORE_API void ConvertFLinearColorsToFColorSRGB(const FLinearColor *InLinearColors, FColor *OutColorsSRGB, int64 InCount)
Definition Color.cpp:276
EForceInit
Definition CoreMiscDefines.h:154
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FArchive & operator<<(FArchive &Ar, FEnvQueryDebugProfileData::FStep &Data)
Definition EnvQueryTypes.cpp:489
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define DECLARE_INTRINSIC_TYPE_LAYOUT(T)
Definition MemoryLayout.h:760
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
#define SA_VALUE(Name, Value)
Definition StructuredArchiveNameHelpers.h:77
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
#define UE_DELTA
Definition UnrealMathUtility.h:186
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 Archive.h:1208
Definition Float16Color.h:13
Definition MemoryImageWriter.h:14
Definition MemoryImageWriter.h:78
Definition MemoryImage.h:49
Definition SecureHash.h:314
Definition StructuredArchiveSlots.h:144
Definition StructuredArchiveSlots.h:52
UE_API FStructuredArchiveRecord EnterRecord()
Definition StructuredArchiveSlots.h:252
Definition Array.h:670
U16 Index
Definition radfft.cpp:71
Definition Color.h:486
static CORE_API const FColor Blue
Definition Color.h:754
static CORE_API const FColor Red
Definition Color.h:752
UE_FORCEINLINE_HINT FColor(EForceInit)
Definition Color.h:500
static CORE_API const FColor Purple
Definition Color.h:759
bool Serialize(FArchive &Ar)
Definition Color.h:525
uint8 A
Definition Color.h:492
static CORE_API const FColor Magenta
Definition Color.h:757
static CORE_API const FColor Turquoise
Definition Color.h:760
UE_FORCEINLINE_HINT bool operator!=(const FColor &C) const
Definition Color.h:549
static CORE_API const FColor Silver
Definition Color.h:761
static FColor MakeRequantizeFrom1010102(int R, int G, int B, int A)
Definition Color.h:654
static CORE_API const FColor Yellow
Definition Color.h:755
static float DequantizeUNorm8ToFloat(int Value8)
Definition Color.h:610
static CORE_API const FColor Cyan
Definition Color.h:756
const uint32 & DWColor(void) const
Definition Color.h:496
constexpr FColor(uint8 InR, uint8 InG, uint8 InB, uint8 InA=255)
Definition Color.h:505
UE_FORCEINLINE_HINT uint32 ToPackedBGRA() const
Definition Color.h:743
void operator+=(const FColor &C)
Definition Color.h:554
bool Serialize(FStructuredArchive::FSlot Slot)
Definition Color.h:537
static uint8 QuantizeUNormFloatTo8(float UnitFloat)
Definition Color.h:600
FColor()=default
static CORE_API const FColor White
Definition Color.h:749
UE_FORCEINLINE_HINT uint32 ToPackedRGBA() const
Definition Color.h:735
UE_FORCEINLINE_HINT bool operator==(const FColor &C) const
Definition Color.h:544
static uint8 Requantize10to8(int Value10)
Definition Color.h:624
static CORE_API const FColor Emerald
Definition Color.h:762
UE_FORCEINLINE_HINT uint32 ToPackedARGB() const
Definition Color.h:719
static CORE_API const FColor Green
Definition Color.h:753
uint32 & DWColor(void)
Definition Color.h:495
UE_FORCEINLINE_HINT uint32 ToPackedABGR() const
Definition Color.h:727
FLinearColor ReinterpretAsLinear() const
Definition Color.h:683
FColor WithAlpha(uint8 Alpha) const
Definition Color.h:672
friend UE_FORCEINLINE_HINT uint32 GetTypeHash(const FColor &Color)
Definition Color.h:764
static CORE_API const FColor Transparent
Definition Color.h:751
static float DequantizeUNorm16ToFloat(int Value16)
Definition Color.h:617
static CORE_API const FColor Orange
Definition Color.h:758
static uint8 Requantize16to8(int Value16)
Definition Color.h:638
static CORE_API const FColor Black
Definition Color.h:750
UE_FORCEINLINE_HINT FColor(uint32 InColor)
Definition Color.h:514
static uint16 QuantizeUNormFloatTo16(float UnitFloat)
Definition Color.h:605
static CORE_API uint32 MemCrc_DEPRECATED(const void *Data, int32 Length, uint32 CRC=0)
Definition Crc.cpp:592
Definition Color.h:48
CORE_API bool InitFromString(const FString &InSourceString)
Definition Color.cpp:545
FLinearColor & operator/=(float Scalar)
Definition Color.h:251
FLinearColor operator+(const FLinearColor &ColorB) const
Definition Color.h:150
static CORE_API FLinearColor MakeRandomSeededColor(int32 Seed)
Definition Color.cpp:529
FLinearColor operator/(float Scalar) const
Definition Color.h:241
float A
Definition Color.h:56
CORE_API FColor ToFColorSRGB() const
Definition Color.cpp:251
static CORE_API const FLinearColor White
Definition Color.h:456
FLinearColor operator*(const FLinearColor &ColorB) const
Definition Color.h:186
static CORE_API FLinearColor FromPow22Color(const FColor &Color)
Definition Color.cpp:74
UE_FORCEINLINE_HINT float GetMax() const
Definition Color.h:390
CORE_API FColor ToRGBE() const
Definition Color.cpp:89
float & Component(int32 Index)
Definition Color.h:136
float G
Definition Color.h:54
static CORE_API const FLinearColor Green
Definition Color.h:461
static CORE_API float sRGBToLinearTable[256]
Definition Color.h:655
float RGBA[4]
Definition Color.h:60
float B
Definition Color.h:55
constexpr UE_FORCEINLINE_HINT FLinearColor(float InR, float InG, float InB, float InA=1.0f)
Definition Color.h:73
friend void operator<<(FStructuredArchive::FSlot Slot, FLinearColor &Color)
Definition Color.h:104
static FLinearColor IntToDistinctColor(const int32 Seed, const float Saturation=1.f, const float Value=1.f, const float HueRotation=180.f)
Helper function to generate distinct colors from a sequence of integers where each integer increment ...
Definition Color.h:445
CORE_API FLinearColor Desaturate(float Desaturation) const
Definition Color.cpp:294
constexpr FLinearColor CopyWithNewOpacity(float NewOpacity) const
Definition Color.h:290
bool IsAlmostBlack() const
Definition Color.h:396
friend FArchive & operator<<(FArchive &Ar, FLinearColor &Color)
Definition Color.h:93
UE_FORCEINLINE_HINT bool Equals(const FLinearColor &ColorB, float Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition Color.h:285
FLinearColor()=default
CORE_API FLinearColor LinearRGBToHSV() const
Definition Color.cpp:383
UE_FORCEINLINE_HINT bool operator==(const FLinearColor &ColorB) const
Definition Color.h:275
static CORE_API const FLinearColor Yellow
Definition Color.h:463
static CORE_API float EvaluateBezier(const FLinearColor *ControlPoints, int32 NumPoints, TArray< FLinearColor > &OutPoints)
Definition UnrealMath.cpp:1170
static CORE_API const FLinearColor Blue
Definition Color.h:462
static CORE_API const FLinearColor Transparent
Definition Color.h:459
FLinearColor & operator*=(const FLinearColor &ColorB)
Definition Color.h:195
friend UE_FORCEINLINE_HINT uint32 GetTypeHash(const FLinearColor &LinearColor)
Definition Color.h:465
UE_FORCEINLINE_HINT float GetMin() const
Definition Color.h:406
FLinearColor operator-(const FLinearColor &ColorB) const
Definition Color.h:168
FLinearColor operator/(const FLinearColor &ColorB) const
Definition Color.h:223
static CORE_API const FLinearColor Red
Definition Color.h:460
static float Clamp01NansTo0(float InValue)
Definition Color.h:429
FLinearColor & operator/=(const FLinearColor &ColorB)
Definition Color.h:232
bool Serialize(FArchive &Ar)
Definition Color.h:98
static CORE_API FLinearColor MakeFromColorTemperature(float Temp)
Definition Color.cpp:504
CORE_API FLinearColor HSVToLinearRGB() const
Definition Color.cpp:411
static CORE_API FLinearColor MakeRandomColor()
Definition Color.cpp:488
CORE_API FString ToString() const
Definition Color.cpp:540
FLinearColor & operator-=(const FLinearColor &ColorB)
Definition Color.h:177
static CORE_API const FLinearColor Black
Definition Color.h:458
static UE_FORCEINLINE_HINT FLinearColor FromSRGBColor(const FColor &Color)
Definition Color.h:123
UE_FORCEINLINE_HINT bool operator!=(const FLinearColor &Other) const
Definition Color.h:279
FLinearColor GetClamped(float InMin=0.0f, float InMax=1.0f) const
Definition Color.h:262
FColor QuantizeRound() const
Definition Color.h:789
static float Dist(const FLinearColor &V1, const FLinearColor &V2)
Definition Color.h:320
CORE_API float GetLuminance() const
Definition Color.cpp:301
FColor QuantizeFloor() const
Definition Color.h:800
float R
Definition Color.h:53
const float & Component(int32 Index) const
Definition Color.h:143
static CORE_API FLinearColor LerpUsingHSV(const FLinearColor &From, const FLinearColor &To, const float Progress)
Definition Color.cpp:445
FLinearColor & operator*=(float Scalar)
Definition Color.h:214
static CORE_API const FLinearColor Gray
Definition Color.h:457
static float Pow22OneOver255Table[256]
Definition Color.h:616
FLinearColor & operator+=(const FLinearColor &ColorB)
Definition Color.h:159
FLinearColor operator*(float Scalar) const
Definition Color.h:204
static CORE_API FLinearColor MakeFromHSV8(uint8 H, uint8 S, uint8 V)
Definition Color.cpp:375
bool Serialize(FStructuredArchive::FSlot Slot)
Definition Color.h:110
FColor ToFColor(const bool bSRGB) const
Definition Color.h:810
static constexpr UE_FORCEINLINE_HINT T Square(const T A)
Definition UnrealMathUtility.h:578
static constexpr UE_FORCEINLINE_HINT T Clamp(const T X, const T MinValue, const T MaxValue)
Definition UnrealMathUtility.h:592
Definition IsPODType.h:12
@ Value
Definition IsPODType.h:13