#include <Color.h>
|
| static UE_FORCEINLINE_HINT FLinearColor | FromSRGBColor (const FColor &Color) |
| |
| static CORE_API FLinearColor | FromPow22Color (const FColor &Color) |
| |
| static CORE_API FLinearColor | MakeFromHSV8 (uint8 H, uint8 S, uint8 V) |
| |
| static CORE_API FLinearColor | MakeRandomColor () |
| |
| static CORE_API FLinearColor | MakeFromColorTemperature (float Temp) |
| |
| static CORE_API FLinearColor | MakeRandomSeededColor (int32 Seed) |
| |
| static float | Dist (const FLinearColor &V1, const FLinearColor &V2) |
| |
| static CORE_API float | EvaluateBezier (const FLinearColor *ControlPoints, int32 NumPoints, TArray< FLinearColor > &OutPoints) |
| |
| static CORE_API FLinearColor | LerpUsingHSV (const FLinearColor &From, const FLinearColor &To, const float Progress) |
| |
| static float | Clamp01NansTo0 (float InValue) |
| |
| 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 spins around the Hue wheel by increments of the golden ratio.
|
| |
A linear, 32-bit/component floating point RGBA color.
- Examples
- /work/Engine/Source/Runtime/UMG/Public/Components/Widget.h.
◆ FLinearColor() [1/9]
| FLinearColor::FLinearColor |
( |
| ) |
|
|
default |
◆ FLinearColor() [2/9]
◆ FLinearColor() [3/9]
◆ FLinearColor() [4/9]
Converts an FColor which is assumed to be in sRGB space, into linear color space.
- Parameters
-
| Color | The sRGB color that needs to be converted into linear space. to get direct conversion use ReinterpretAsLinear |
◆ 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]
◆ Clamp01NansTo0()
Helper for pixel format conversions. Clamps to [0,1], mapping NaNs to 0, for consistency with GPU conversions.
- Parameters
-
- Returns
- InValue clamped to [0,1]. NaNs map to 0.
◆ Component() [1/2]
◆ Component() [2/2]
| const float & FLinearColor::Component |
( |
int32 |
Index | ) |
const |
|
inline |
◆ CopyWithNewOpacity()
◆ Desaturate()
Returns a desaturated color, with 0 meaning no desaturation and 1 == full desaturation
- Parameters
-
| Desaturation | Desaturation factor in range [0..1] |
- Returns
- Desaturated color
◆ Dist()
Euclidean distance between two points.
◆ Equals()
◆ EvaluateBezier()
Generates a list of sample points on a Bezier curve defined by 2 points.
- Parameters
-
| ControlPoints | Array of 4 Linear Colors (vert1, controlpoint1, controlpoint2, vert2). |
| NumPoints | Number of samples. |
| OutPoints | Receives the output samples. |
- Returns
- Path length.
◆ FromPow22Color()
Converts an FColor coming from an observed Pow(1/2.2) output, into a linear color.
- Parameters
-
| Color | The Pow(1/2.2) color that needs to be converted into linear space. |
◆ FromSRGBColor()
Converts an FColor coming from an observed sRGB output, into a linear color.
- Parameters
-
| Color | The sRGB color that needs to be converted into linear space. |
◆ GetClamped()
◆ GetLuminance()
| float FLinearColor::GetLuminance |
( |
| ) |
const |
Computes the perceptually weighted luminance value of a color.
◆ GetMax()
Returns the maximum value in this color structure
- Returns
- The maximum color channel value
◆ GetMin()
Returns the minimum value in this color structure
- Returns
- The minimum color channel value
◆ HSVToLinearRGB()
Converts an HSV color to a linear space RGB color
◆ InitFromString()
| bool FLinearColor::InitFromString |
( |
const FString & |
InSourceString | ) |
|
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
-
| InSourceString | FString containing the color values. |
- Returns
- true if the R,G,B values were read successfully; false otherwise.
◆ IntToDistinctColor()
Helper function to generate distinct colors from a sequence of integers where each integer increment spins around the Hue wheel by increments of the golden ratio.
- Parameters
-
| Seed | the "seed" for a semi-random, but deterministic color |
| Saturation | 0-1 saturation of resulting color |
| Value | 0-1 brightness of resulting color |
| HueRotation | 0-360 amount to rotate around the hue wheel |
- Returns
- color with semi-random hue
◆ IsAlmostBlack()
| bool FLinearColor::IsAlmostBlack |
( |
| ) |
const |
|
inline |
useful to detect if a light contribution needs to be rendered
◆ LerpUsingHSV()
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
-
| From | The color and alpha to interpolate from as linear RGBA |
| To | The color and alpha to interpolate to as linear RGBA |
| Progress | Scalar 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()
Converts a linear space RGB color to an HSV color
◆ MakeFromColorTemperature()
Converts temperature in Kelvins of a black body radiator to RGB chromaticity.
◆ MakeFromHSV8()
Converts byte hue-saturation-brightness to floating point red-green-blue.
◆ MakeRandomColor()
Makes a random but quite nice color.
◆ MakeRandomSeededColor()
Makes a random color based on a seed.
◆ operator!=()
◆ operator*() [1/2]
◆ operator*() [2/2]
◆ operator*=() [1/2]
◆ operator*=() [2/2]
◆ operator+()
◆ operator+=()
◆ operator-()
◆ operator-=()
◆ operator/() [1/2]
◆ operator/() [2/2]
◆ operator/=() [1/2]
◆ operator/=() [2/2]
◆ operator==()
◆ QuantizeFloor()
| FColor FLinearColor::QuantizeFloor |
( |
| ) |
const |
|
inline |
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.
◆ QuantizeRound()
| FColor FLinearColor::QuantizeRound |
( |
| ) |
const |
|
inline |
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
◆ Serialize() [1/2]
◆ Serialize() [2/2]
◆ ToFColor()
| FColor FLinearColor::ToFColor |
( |
const bool |
bSRGB | ) |
const |
|
inline |
◆ 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
Quantizes the linear color and returns the result as a FColor with optional sRGB conversion and quality as goal.
◆ ToRGBE()
| FColor FLinearColor::ToRGBE |
( |
| ) |
const |
◆ ToString()
| FString FLinearColor::ToString |
( |
| ) |
const |
◆ GetTypeHash
◆ operator<< [1/2]
◆ operator<< [2/2]
◆ [union]
◆ Black
◆ Blue
◆ Gray
◆ Green
◆ Pow22OneOver255Table
| float FLinearColor::Pow22OneOver255Table |
|
static |
◆ Red
◆ RGBA
| float FLinearColor::RGBA[4] |
◆ sRGBToLinearTable
| float FLinearColor::sRGBToLinearTable |
|
static |
Static lookup table used for FColor -> FLinearColor conversion. sRGB
Table for fast FColor -> FLinearColor conversion.
Color > 0.04045 ? pow( Color * (1.0 / 1.055) + 0.0521327, 2.4 ) : Color * (1.0 / 12.92);
◆ Transparent
◆ White
◆ Yellow
The documentation for this struct was generated from the following files:
- Engine/Source/Runtime/Core/Public/Math/Color.h
- Engine/Source/Runtime/Core/Private/Math/Color.cpp
- Engine/Source/Runtime/Core/Private/Math/UnrealMath.cpp