unreal.LinearColor
¶
-
class
unreal.
LinearColor
(r=0.0, g=0.0, b=0.0, a=0.0)¶ Bases:
unreal.StructBase
A linear, 32-bit/component floating point RGBA color. 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] Ab
(float): [Read-Write] Bg
(float): [Read-Write] Gr
(float): [Read-Write] R
-
BLACK
= None¶ Black linear color
- Type
-
BLUE
= None¶ Blue linear color
- Type
-
GRAY
= None¶ Grey linear color
- Type
-
GREEN
= None¶ Green linear color
- Type
-
RED
= None¶ Red linear color
- Type
-
TANSPARENT
= None¶ Transparent linear color - black with 0 opacity/alpha
- Type
-
WHITE
= None¶ White linear color
- Type
-
YELLOW
= None¶ Yellow linear color
- Type
-
__add__
(other)¶ Overloads:
LinearColor
Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
-
__eq__
(other)¶ 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)¶ Overloads:
LinearColor
Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
-
__imul__
(other)¶ Overloads:
LinearColor
Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
-
__isub__
(other)¶ Overloads:
LinearColor
Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
-
__mul__
(other)¶ Overloads:
LinearColor
Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
-
__ne__
(other)¶ Overloads:
LinearColor
Returns true if linear color A is not equal to linear color B (A != B) within a specified error tolerance
-
__sub__
(other)¶ Overloads:
LinearColor
Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
-
__truediv__
(other)¶ 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) –
- Returns
- 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) –
- Returns
- Return type
-
divide
(b) → LinearColor¶ Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)
- Parameters
b (LinearColor) –
- Returns
- 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) –
- Returns
- 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.
- Returns
- 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
- Returns
- 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.0001) → 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) –
- Returns
- 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) –
- Returns
- 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) –
- Returns
- 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) –
- Returns
- 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) –
- Returns
- Return type
-
quantize
() → Color¶ Quantizes the linear color and returns the result as an 8-bit color. This bypasses the SRGB conversion.
- Returns
- 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.
- Returns
- 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)
- Returns
- 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) –
- Returns
- 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) –
- Returns
- Return type