unreal.LinearColor
¶
- class unreal.LinearColor(r: float = 0.0, g: float = 0.0, b: float = 0.0, a: float = 0.0)¶
Bases:
StructBase
A linear, 32-bit/component floating point RGBA color. note: The full C++ class is located here: EngineSourceRuntimeCorePublicMathColor.h
C++ Source:
Module: CoreUObject
File: NoExportTypes.h
Editor Properties: (see get_editor_property/set_editor_property)
a
(float): [Read-Write]b
(float): [Read-Write]g
(float): [Read-Write]r
(float): [Read-Write]
- BLACK: LinearColor¶
Black linear color
- Type:
- BLUE: LinearColor¶
Blue linear color
- Type:
- GRAY: LinearColor¶
Grey linear color
- Type:
- GREEN: LinearColor¶
Green linear color
- Type:
- RED: LinearColor¶
Red linear color
- Type:
- TRANSPARENT: LinearColor¶
Transparent linear color - black with 0 opacity/alpha
- Type:
- WHITE: LinearColor¶
White linear color
- Type:
- YELLOW: LinearColor¶
Yellow linear color
- Type:
- __add__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
- __eq__(other: object) bool ¶
Overloads:
LinearColor
Returns true if linear color A is equal to linear color B (A == B) within a specified error toleranceLinearColor
Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
- __iadd__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
- __imul__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
- __isub__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
- __mul__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
- __ne__(other: object) bool ¶
Overloads:
LinearColor
Returns true if linear color A is not equal to linear color B (A != B) within a specified error tolerance
- __sub__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
- __truediv__(other: LinearColor) None ¶
Overloads:
LinearColor
Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)
- add(b) LinearColor ¶
Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
- Parameters:
b (LinearColor) –
- Return type:
- desaturated(desaturation) LinearColor ¶
Returns a desaturated color, with 0 meaning no desaturation and 1 == full desaturation
- Parameters:
desaturation (float) –
- Returns:
Desaturated color
- Return type:
- distance(c2) float ¶
Euclidean distance between two color points.
- Parameters:
c2 (LinearColor) –
- Return type:
- divide(b) LinearColor ¶
Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)
- Parameters:
b (LinearColor) –
- Return type:
- equals(b) bool ¶
Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
- Parameters:
b (LinearColor) –
- Return type:
- get_luminance() float ¶
Returns the perceived brightness of a color on a display taking into account the impact on the human eye per color channel: green > red > blue.
- Return type:
- get_max() float ¶
Returns the maximum color channel value in this color structure
- Returns:
The maximum color channel value
- Return type:
- get_min() float ¶
Returns the minimum color channel value in this color structure
- Returns:
The minimum color channel value
- Return type:
- hsv_into_rgb() LinearColor ¶
Converts a HSV linear color (where H is in R (0..360), S is in G (0..1), and V is in B (0..1)) to RGB
- Returns:
rgb (LinearColor):
- Return type:
- hsv_to_rgb() LinearColor ¶
Converts a HSV linear color (where H is in R, S is in G, and V is in B) to linear RGB
- Return type:
- interpolate_to(target, delta_time, interp_speed) LinearColor ¶
Interpolate Linear Color from Current to Target. Scaled by distance to Target, so it has a strong start speed and ease out.
- Parameters:
target (LinearColor) – Target Color
delta_time (float) – Time since last tick
interp_speed (float) – Interpolation speed, if the speed given is 0, then jump to the target.
- Returns:
New interpolated Color
- Return type:
- is_near_equal(b, tolerance=0.000100) bool ¶
Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
- Parameters:
b (LinearColor) –
tolerance (float) –
- Return type:
- lerp_to(b, alpha) LinearColor ¶
Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)
- Parameters:
b (LinearColor) –
alpha (float) –
- Return type:
- lerp_using_hsv_to(b, alpha) LinearColor ¶
Linearly interpolates between two colors by the specified Alpha amount (100% of A when Alpha=0 and 100% of B when Alpha=1). The interpolation is performed in HSV color space taking the shortest path to the new color’s hue. This can give better results than a normal 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:
b (LinearColor) – The color and alpha to interpolate to as linear RGBA
alpha (float) – 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
- Return type:
- multiply(b) LinearColor ¶
Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
- Parameters:
b (LinearColor) –
- Return type:
- multiply_float(b) LinearColor ¶
Element-wise multiplication of a linear color by a float (F*R, F*G, F*B, F*A)
- Parameters:
b (float) –
- Return type:
- not_equal(b) bool ¶
Returns true if linear color A is not equal to linear color B (A != B) within a specified error tolerance
- Parameters:
b (LinearColor) –
- Return type:
- quantize() Color ¶
Quantizes the linear color and returns the result as an 8-bit color. This bypasses the SRGB conversion. deprecated: Use LinearColor_QuantizeRound instead for correct color conversion.
- Return type:
- quantize_round() Color ¶
Quantizes the linear color with rounding and returns the result as an 8-bit color. This bypasses the SRGB conversion.
- Return type:
- rgb_into_hsv() LinearColor ¶
Converts a RGB linear color to HSV (where H is in R (0..360), S is in G (0..1), and V is in B (0..1))
- Returns:
hsv (LinearColor):
- Return type:
- rgb_into_hsv_components() -> (h=float, s=float, v=float, a=float)¶
Breaks apart a color into individual HSV components (as well as alpha) (Hue is [0..360) while Saturation and Value are 0..1)
- Returns:
h (float):
s (float):
v (float):
a (float):
- Return type:
tuple
- rgb_to_hsv() LinearColor ¶
Converts a RGB linear color to HSV (where H is in R, S is in G, and V is in B)
- Return type:
- set(color) None ¶
Assign contents of InColor
- Parameters:
color (LinearColor) –
- set_from_pow22(color) None ¶
Assigns an FColor coming from an observed Pow(1/2.2) output, into a linear color.
- Parameters:
color (Color) – The Pow(1/2.2) color that needs to be converted into linear space.
- set_from_srgb(srgb) None ¶
Assigns an FColor coming from an observed sRGB output, into a linear color.
- Parameters:
srgb (Color) – The sRGB color that needs to be converted into linear space.
- set_temperature(temperature) None ¶
Converts temperature in Kelvins of a black body radiator to RGB chromaticity.
- Parameters:
temperature (float) –
- subtract(b) LinearColor ¶
Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
- Parameters:
b (LinearColor) –
- Return type:
- to_color(use_srgb=True) Color ¶
Quantizes the linear color and returns the result as a FColor with optional sRGB conversion and quality as goal.
- to_new_opacity(opacity) LinearColor ¶
Returns a copy of this color using the specified opacity/alpha.
- Parameters:
opacity (float) –
- Return type: