Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FLinearColor Struct Reference

#include <Color.h>

+ Collaboration diagram for FLinearColor:

Public Member Functions

FORCEINLINE FLinearColor ()
 
FORCEINLINE FLinearColor (EForceInit)
 
constexpr FORCEINLINE FLinearColor (float InR, float InG, float InB, float InA=1.0f)
 
FORCEINLINE FLinearColor (const FColor &Color)
 
 FLinearColor (const FVector3f &Vector)
 
 FLinearColor (const FVector3d &Vector)
 
 FLinearColor (const FVector4f &Vector)
 
 FLinearColor (const FVector4d &Vector)
 
 FLinearColor (const FFloat16Color &C)
 
bool Serialize (FStructuredArchive::FSlot Slot)
 
FColor ToRGBE () const
 
FORCEINLINE floatComponent (int32 Index)
 
FORCEINLINE const floatComponent (int32 Index) const
 
FORCEINLINE void operator= (const FLinearColor &ColorB)
 
FORCEINLINE FLinearColor operator+ (const FLinearColor &ColorB) const
 
FORCEINLINE FLinearColoroperator+= (const FLinearColor &ColorB)
 
FORCEINLINE FLinearColor operator- (const FLinearColor &ColorB) const
 
FORCEINLINE FLinearColoroperator-= (const FLinearColor &ColorB)
 
FORCEINLINE FLinearColor operator* (const FLinearColor &ColorB) const
 
FORCEINLINE FLinearColoroperator*= (const FLinearColor &ColorB)
 
FORCEINLINE FLinearColor operator* (float Scalar) const
 
FORCEINLINE FLinearColoroperator*= (float Scalar)
 
FORCEINLINE FLinearColor operator/ (const FLinearColor &ColorB) const
 
FORCEINLINE FLinearColoroperator/= (const FLinearColor &ColorB)
 
FORCEINLINE FLinearColor operator/ (float Scalar) const
 
FORCEINLINE FLinearColoroperator/= (float Scalar)
 
FORCEINLINE FLinearColor GetClamped (float InMin=0.0f, float InMax=1.0f) const
 
FORCEINLINE bool operator== (const FLinearColor &ColorB) const
 
FORCEINLINE bool operator!= (const FLinearColor &Other) const
 
FORCEINLINE bool Equals (const FLinearColor &ColorB, float Tolerance=UE_KINDA_SMALL_NUMBER) const
 
FLinearColor CopyWithNewOpacity (float NewOpacicty) const
 
FLinearColor LinearRGBToHSV () const
 
FLinearColor HSVToLinearRGB () const
 
FORCEINLINE FColor QuantizeRound () const
 
FORCEINLINE FColor QuantizeFloor () const
 
FORCEINLINE FColor Quantize () const
 
FColor ToFColorSRGB () const
 
FORCEINLINE FColor ToFColor (const bool bSRGB) const
 
FLinearColor Desaturate (float Desaturation) const
 
float GetLuminance () const
 
FORCEINLINE float GetMax () const
 
bool IsAlmostBlack () const
 
FORCEINLINE float GetMin () const
 
FString ToString () const
 
bool InitFromString (const FString &InSourceString)
 

Static Public Member Functions

static FORCEINLINE FLinearColor FromSRGBColor (const FColor &Color)
 
static FLinearColor FromPow22Color (const FColor &Color)
 
static FLinearColor FGetHSV (uint8 H, uint8 S, uint8 V)
 
static FLinearColor MakeFromHSV8 (uint8 H, uint8 S, uint8 V)
 
static FLinearColor MakeRandomColor ()
 
static FLinearColor MakeFromColorTemperature (float Temp)
 
static FLinearColor MakeRandomSeededColor (int32 Seed)
 
static float Dist (const FLinearColor &V1, const FLinearColor &V2)
 
static float EvaluateBezier (const FLinearColor *ControlPoints, int32 NumPoints, TArray< FLinearColor > &OutPoints)
 
static FLinearColor LerpUsingHSV (const FLinearColor &From, const FLinearColor &To, const float Progress)
 
static FORCEINLINE float Clamp01NansTo0 (float InValue)
 

Public Attributes

union { 
 
   struct { 
 
      float   R 
 
      float   G 
 
      float   B 
 
      float   A 
 
   }  
 
   float   RGBA [4] 
 
};  
 

Static Public Attributes

static float Pow22OneOver255Table [256]
 
static CONSTEXPR double sRGBToLinearTable [256]
 
static const FLinearColor White
 
static const FLinearColor Gray
 
static const FLinearColor Black
 
static const FLinearColor Transparent
 
static const FLinearColor Red
 
static const FLinearColor Green
 
static const FLinearColor Blue
 
static const FLinearColor Yellow
 

Friends

void operator<< (FStructuredArchive::FSlot Slot, FLinearColor &Color)
 
FORCEINLINE uint32 GetTypeHash (const FLinearColor &LinearColor)
 

Detailed Description

A linear, 32-bit/component floating point RGBA color.

Definition at line 47 of file Color.h.

Constructor & Destructor Documentation

◆ FLinearColor() [1/9]

FORCEINLINE FLinearColor::FLinearColor ( )
inline

Definition at line 124 of file Color.h.

◆ FLinearColor() [2/9]

FORCEINLINE FLinearColor::FLinearColor ( EForceInit )
inlineexplicit

Definition at line 125 of file Color.h.

◆ FLinearColor() [3/9]

constexpr FORCEINLINE FLinearColor::FLinearColor ( float InR,
float InG,
float InB,
float InA = 1.0f )
inlineconstexpr

Definition at line 128 of file Color.h.

+ Here is the caller graph for this function:

◆ FLinearColor() [4/9]

FORCEINLINE FLinearColor::FLinearColor ( const FColor & Color)

Converts an FColor which is assumed to be in sRGB space, into linear color space.

Parameters
ColorThe sRGB color that needs to be converted into linear space. to get direct conversion use ReinterpretAsLinear

Definition at line 862 of file Color.h.

+ Here is the caller graph for this function:

◆ FLinearColor() [5/9]

FLinearColor::FLinearColor ( const FVector3f & Vector)

◆ FLinearColor() [6/9]

FLinearColor::FLinearColor ( const FVector3d & Vector)
explicit

◆ FLinearColor() [7/9]

FLinearColor::FLinearColor ( const FVector4f & Vector)

◆ FLinearColor() [8/9]

FLinearColor::FLinearColor ( const FVector4d & Vector)
explicit

◆ FLinearColor() [9/9]

FLinearColor::FLinearColor ( const FFloat16Color & C)
explicit

Member Function Documentation

◆ Clamp01NansTo0()

static FORCEINLINE float FLinearColor::Clamp01NansTo0 ( float InValue)
inlinestatic

Helper for pixel format conversions. Clamps to [0,1], mapping NaNs to 0, for consistency with GPU conversions.

Parameters
InValueThe input value.
Returns
InValue clamped to [0,1]. NaNs map to 0.

Definition at line 508 of file Color.h.

+ Here is the caller graph for this function:

◆ Component() [1/2]

FORCEINLINE float & FLinearColor::Component ( int32 Index)
inline

Definition at line 180 of file Color.h.

◆ Component() [2/2]

FORCEINLINE const float & FLinearColor::Component ( int32 Index) const
inline

Definition at line 187 of file Color.h.

◆ CopyWithNewOpacity()

FLinearColor FLinearColor::CopyWithNewOpacity ( float NewOpacicty) const
inline

Definition at line 342 of file Color.h.

◆ Desaturate()

FLinearColor FLinearColor::Desaturate ( float Desaturation) const

Returns a desaturated color, with 0 meaning no desaturation and 1 == full desaturation

Parameters
DesaturationDesaturation factor in range [0..1]
Returns
Desaturated color

◆ Dist()

static float FLinearColor::Dist ( const FLinearColor & V1,
const FLinearColor & V2 )
inlinestatic

Euclidean distance between two points.

Definition at line 375 of file Color.h.

◆ Equals()

FORCEINLINE bool FLinearColor::Equals ( const FLinearColor & ColorB,
float Tolerance = UE_KINDA_SMALL_NUMBER ) const
inline

Definition at line 337 of file Color.h.

◆ EvaluateBezier()

static float FLinearColor::EvaluateBezier ( const FLinearColor * ControlPoints,
int32 NumPoints,
TArray< FLinearColor > & OutPoints )
static

Generates a list of sample points on a Bezier curve defined by 2 points.

Parameters
ControlPointsArray of 4 Linear Colors (vert1, controlpoint1, controlpoint2, vert2).
NumPointsNumber of samples.
OutPointsReceives the output samples.
Returns
Path length.

◆ FGetHSV()

static FLinearColor FLinearColor::FGetHSV ( uint8 H,
uint8 S,
uint8 V )
static

◆ FromPow22Color()

static FLinearColor FLinearColor::FromPow22Color ( const FColor & Color)
static

Converts an FColor coming from an observed Pow(1/2.2) output, into a linear color.

Parameters
ColorThe Pow(1/2.2) color that needs to be converted into linear space.

◆ FromSRGBColor()

static FORCEINLINE FLinearColor FLinearColor::FromSRGBColor ( const FColor & Color)
inlinestatic

Converts an FColor coming from an observed sRGB output, into a linear color.

Parameters
ColorThe sRGB color that needs to be converted into linear space.

Definition at line 167 of file Color.h.

+ Here is the call graph for this function:

◆ GetClamped()

FORCEINLINE FLinearColor FLinearColor::GetClamped ( float InMin = 0.0f,
float InMax = 1.0f ) const
inline

Definition at line 314 of file Color.h.

+ Here is the call graph for this function:

◆ GetLuminance()

float FLinearColor::GetLuminance ( ) const
inline

Computes the perceptually weighted luminance value of a color.

Definition at line 444 of file Color.h.

◆ GetMax()

FORCEINLINE float FLinearColor::GetMax ( ) const
inline

Returns the maximum value in this color structure

Returns
The maximum color channel value

Definition at line 454 of file Color.h.

◆ GetMin()

FORCEINLINE float FLinearColor::GetMin ( ) const
inline

Returns the minimum value in this color structure

Returns
The minimum color channel value

Definition at line 470 of file Color.h.

◆ HSVToLinearRGB()

FLinearColor FLinearColor::HSVToLinearRGB ( ) const

Converts an HSV color to a linear space RGB color

◆ InitFromString()

bool FLinearColor::InitFromString ( const FString & InSourceString)
inline

Initialize this Color based on an FString. The String is expected to contain R=, G=, B=, A=. The FLinearColor will be bogus when InitFromString returns false.

Parameters
InSourceStringFString containing the color values.
Returns
true if the R,G,B values were read successfully; false otherwise.

Definition at line 487 of file Color.h.

+ Here is the call graph for this function:

◆ IsAlmostBlack()

bool FLinearColor::IsAlmostBlack ( ) const
inline

useful to detect if a light contribution needs to be rendered

Definition at line 460 of file Color.h.

◆ LerpUsingHSV()

static FLinearColor FLinearColor::LerpUsingHSV ( const FLinearColor & From,
const FLinearColor & To,
const float Progress )
static

Linearly interpolates between two colors by the specified progress amount. The interpolation is performed in HSV color space taking the shortest path to the new color's hue. This can give better results than FMath::Lerp(), but is much more expensive. The incoming colors are in RGB space, and the output color will be RGB. The alpha value will also be interpolated.

Parameters
FromThe color and alpha to interpolate from as linear RGBA
ToThe color and alpha to interpolate to as linear RGBA
ProgressScalar interpolation amount (usually between 0.0 and 1.0 inclusive)
Returns
The interpolated color in linear RGB space along with the interpolated alpha value

◆ LinearRGBToHSV()

FLinearColor FLinearColor::LinearRGBToHSV ( ) const

Converts a linear space RGB color to an HSV color

◆ MakeFromColorTemperature()

static FLinearColor FLinearColor::MakeFromColorTemperature ( float Temp)
static

Converts temperature in Kelvins of a black body radiator to RGB chromaticity.

◆ MakeFromHSV8()

static FLinearColor FLinearColor::MakeFromHSV8 ( uint8 H,
uint8 S,
uint8 V )
static

Converts byte hue-saturation-brightness to floating point red-green-blue.

◆ MakeRandomColor()

static FLinearColor FLinearColor::MakeRandomColor ( )
static

Makes a random but quite nice color.

◆ MakeRandomSeededColor()

static FLinearColor FLinearColor::MakeRandomSeededColor ( int32 Seed)
static

Makes a random color based on a seed.

◆ operator!=()

FORCEINLINE bool FLinearColor::operator!= ( const FLinearColor & Other) const
inline

Definition at line 331 of file Color.h.

◆ operator*() [1/2]

FORCEINLINE FLinearColor FLinearColor::operator* ( const FLinearColor & ColorB) const
inline

Definition at line 238 of file Color.h.

+ Here is the call graph for this function:

◆ operator*() [2/2]

FORCEINLINE FLinearColor FLinearColor::operator* ( float Scalar) const
inline

Definition at line 256 of file Color.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator*=() [1/2]

FORCEINLINE FLinearColor & FLinearColor::operator*= ( const FLinearColor & ColorB)
inline

Definition at line 247 of file Color.h.

◆ operator*=() [2/2]

FORCEINLINE FLinearColor & FLinearColor::operator*= ( float Scalar)
inline

Definition at line 266 of file Color.h.

◆ operator+()

FORCEINLINE FLinearColor FLinearColor::operator+ ( const FLinearColor & ColorB) const
inline

Definition at line 202 of file Color.h.

+ Here is the call graph for this function:

◆ operator+=()

FORCEINLINE FLinearColor & FLinearColor::operator+= ( const FLinearColor & ColorB)
inline

Definition at line 211 of file Color.h.

◆ operator-()

FORCEINLINE FLinearColor FLinearColor::operator- ( const FLinearColor & ColorB) const
inline

Definition at line 220 of file Color.h.

+ Here is the call graph for this function:

◆ operator-=()

FORCEINLINE FLinearColor & FLinearColor::operator-= ( const FLinearColor & ColorB)
inline

Definition at line 229 of file Color.h.

◆ operator/() [1/2]

FORCEINLINE FLinearColor FLinearColor::operator/ ( const FLinearColor & ColorB) const
inline

Definition at line 275 of file Color.h.

+ Here is the call graph for this function:

◆ operator/() [2/2]

FORCEINLINE FLinearColor FLinearColor::operator/ ( float Scalar) const
inline

Definition at line 293 of file Color.h.

+ Here is the call graph for this function:

◆ operator/=() [1/2]

FORCEINLINE FLinearColor & FLinearColor::operator/= ( const FLinearColor & ColorB)
inline

Definition at line 284 of file Color.h.

◆ operator/=() [2/2]

FORCEINLINE FLinearColor & FLinearColor::operator/= ( float Scalar)
inline

Definition at line 303 of file Color.h.

◆ operator=()

FORCEINLINE void FLinearColor::operator= ( const FLinearColor & ColorB)
inline

Definition at line 194 of file Color.h.

+ Here is the caller graph for this function:

◆ operator==()

FORCEINLINE bool FLinearColor::operator== ( const FLinearColor & ColorB) const
inline

Comparison operators

Definition at line 327 of file Color.h.

◆ Quantize()

FORCEINLINE FColor FLinearColor::Quantize ( ) const

backwards compatible Quantize function name, does QuantizeFloor.

Todo
deprecate me

Definition at line 891 of file Color.h.

+ Here is the call graph for this function:

◆ QuantizeFloor()

FORCEINLINE FColor FLinearColor::QuantizeFloor ( ) const

Quantizes the linear color and returns the result as a FColor. This bypasses the SRGB conversion. Uses floor quantization, which does not match the GPU standard conversion. Restoration to float should be done with a +0.5 bias to restore to centered buckets. Do NOT use this for graphics or textures or images, use QuantizeRound instead.

Definition at line 881 of file Color.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QuantizeRound()

FORCEINLINE FColor FLinearColor::QuantizeRound ( ) const

Quantizes the linear color with rounding and returns the result as a FColor. This bypasses the SRGB conversion. QuantizeRound can be dequantized back to linear with FColor::ReinterpretAsLinear (just /255.f) this matches the GPU UNORM<->float conversion spec and should be preferred

Definition at line 870 of file Color.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Serialize()

bool FLinearColor::Serialize ( FStructuredArchive::FSlot Slot)
inline

Definition at line 154 of file Color.h.

◆ ToFColor()

FORCEINLINE FColor FLinearColor::ToFColor ( const bool bSRGB) const

Definition at line 896 of file Color.h.

+ Here is the call graph for this function:

◆ ToFColorSRGB()

FColor FLinearColor::ToFColorSRGB ( ) const

Quantizes the linear color and returns the result as a FColor with optional sRGB conversion. Clamps in [0,1] range before conversion. ToFColor(false) is QuantizeRound

+ Here is the caller graph for this function:

◆ ToRGBE()

FColor FLinearColor::ToRGBE ( ) const

◆ ToString()

FString FLinearColor::ToString ( ) const
inline

Definition at line 475 of file Color.h.

Friends And Related Symbol Documentation

◆ GetTypeHash

FORCEINLINE uint32 GetTypeHash ( const FLinearColor & LinearColor)
friend

Definition at line 526 of file Color.h.

◆ operator<<

void operator<< ( FStructuredArchive::FSlot Slot,
FLinearColor & Color )
friend

Definition at line 148 of file Color.h.

Member Data Documentation

◆ [union]

union { ... } FLinearColor

◆ A

float FLinearColor::A

Definition at line 56 of file Color.h.

◆ B

float FLinearColor::B

Definition at line 55 of file Color.h.

◆ Black

const FLinearColor FLinearColor::Black
static

Definition at line 519 of file Color.h.

◆ Blue

const FLinearColor FLinearColor::Blue
static

Definition at line 523 of file Color.h.

◆ G

float FLinearColor::G

Definition at line 54 of file Color.h.

◆ Gray

const FLinearColor FLinearColor::Gray
static

Definition at line 518 of file Color.h.

◆ Green

const FLinearColor FLinearColor::Green
static

Definition at line 522 of file Color.h.

◆ Pow22OneOver255Table

float FLinearColor::Pow22OneOver255Table[256]
static

Static lookup table used for FColor -> FLinearColor conversion. Pow(2.2)

Definition at line 64 of file Color.h.

◆ R

float FLinearColor::R

Definition at line 53 of file Color.h.

◆ Red

const FLinearColor FLinearColor::Red
static

Definition at line 521 of file Color.h.

◆ RGBA

float FLinearColor::RGBA[4]

Definition at line 60 of file Color.h.

◆ sRGBToLinearTable

CONSTEXPR double FLinearColor::sRGBToLinearTable[256]
static

Static lookup table used for FColor -> FLinearColor conversion. sRGB

Definition at line 68 of file Color.h.

◆ Transparent

const FLinearColor FLinearColor::Transparent
static

Definition at line 520 of file Color.h.

◆ White

const FLinearColor FLinearColor::White
static

Definition at line 517 of file Color.h.

◆ Yellow

const FLinearColor FLinearColor::Yellow
static

Definition at line 524 of file Color.h.


The documentation for this struct was generated from the following file: