Navigation
API > API/Runtime > API/Runtime/Core
FColor Stores a color with 8 bits of precision per channel. 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! This can be done with FLinearColor::ToFColor(true)
| Name | FColor |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/Math/Color.h |
| Include Path | #include "Math/Color.h" |
Syntax
struct FColor
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FColor () |
Constructors. | Math/Color.h | |
FColor
(
EForceInit |
Math/Color.h | ||
FColor
(
uint32 InColor |
Math/Color.h | ||
constexpr FColor
(
uint8 InR, |
Put these into the body for proper ordering with INTEL vs non-INTEL_BYTE_ORDER | Math/Color.h | |
FColor
(
const FLinearColor& LinearColor |
Please use .ToFColor(true) on FLinearColor if you wish to convert from FLinearColor to FColor, with proper sRGB conversion applied. | Math/Color.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| Black | const FColor | Math/Color.h | |
| Blue | const FColor | Math/Color.h | |
| Cyan | const FColor | Math/Color.h | |
| Emerald | const FColor | Math/Color.h | |
| Green | const FColor | Math/Color.h | |
| Magenta | const FColor | Math/Color.h | |
| Orange | const FColor | Math/Color.h | |
| Purple | const FColor | Math/Color.h | |
| Red | const FColor | Math/Color.h | |
| Silver | const FColor | Math/Color.h | |
| Transparent | const FColor | Math/Color.h | |
| Turquoise | const FColor | Math/Color.h | |
| White | const FColor | Some pre-inited colors, useful for debug code | Math/Color.h |
| Yellow | const FColor | Math/Color.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| A | uint8 | Math/Color.h | ||
| B | uint8 | Math/Color.h | ||
| Bits | uint32 | Math/Color.h | ||
| FColor | union FColor | Variables. | Math/Color.h | |
| G | uint8 | Math/Color.h | ||
| R | uint8 | Math/Color.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const uint32 & DWColor () |
Math/Color.h | ||
uint32 & DWColor () |
Math/Color.h | ||
| Converts from RGBE to a linear float color as outlined in Gregory Ward's Real Pixels article, Graphics Gems II, page 80. | Math/Color.h | ||
bool InitFromString
(
const FString& InSourceString |
Initialize this Color based on an FString. | Math/Color.h | |
| Reinterprets the color as a linear color. | Math/Color.h | ||
| Math/Color.h | |||
bool Serialize
(
FStructuredArchive::FSlot Slot |
Math/Color.h | ||
| Converts this color value to a hexadecimal string.The format of the string is RRGGBBAA. | Math/Color.h | ||
uint32 ToPackedABGR() |
Gets the color in a packed uint32 format packed in the order ABGR. | Math/Color.h | |
uint32 ToPackedARGB() |
Gets the color in a packed uint32 format packed in the order ARGB. | Math/Color.h | |
uint32 ToPackedBGRA() |
Gets the color in a packed uint32 format packed in the order BGRA. | Math/Color.h | |
uint32 ToPackedRGBA() |
Gets the color in a packed uint32 format packed in the order RGBA. | Math/Color.h | |
| Converts this color value to a string. | Math/Color.h | ||
FColor WithAlpha
(
uint8 Alpha |
Math/Color.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static float DequantizeUNorm16ToFloat
(
int Value16 |
Math/Color.h | ||
static float DequantizeUNorm8ToFloat
(
int Value8 |
Math/Color.h | ||
| Creates a color value from the given hexadecimal string. | Math/Color.h | ||
static FColor MakeFromColorTemperature
(
float Temp |
Converts temperature in Kelvins of a black body radiator to RGB chromaticity. | Math/Color.h | |
static FColor MakeRandomColor() |
Makes a random but quite nice color. | Math/Color.h | |
static FColor MakeRandomSeededColor
(
int32 Seed |
Makes a random color based on a seed. | Math/Color.h | |
static FColor MakeRedToGreenColorFromScalar
(
float Scalar |
Makes a color red->green with the passed in scalar (e.g. 0 is red, 1 is green) | Math/Color.h | |
static FColor MakeRequantizeFrom1010102
(
int R, |
Return 8-bit color Quantized from 10-bit RGB , 2-bit A | Math/Color.h | |
static uint16 QuantizeUNormFloatTo16
(
float UnitFloat |
Math/Color.h | ||
static uint8 QuantizeUNormFloatTo8
(
float UnitFloat |
Conversions to/from GPU UNorm floats, U8, U16 matches convention of FColorFLinearColor::QuantizeRound | Math/Color.h | |
static uint8 Requantize10to8
(
int Value10 |
Math/Color.h | ||
static uint8 Requantize16to8
(
int Value16 |
Math/Color.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool operator!=
(
const FColor& C |
Math/Color.h | ||
void operator+=
(
const FColor& C |
Math/Color.h | ||
bool operator==
(
const FColor& C |
Operators. | Math/Color.h |