Difference between revisions of "HPL3/SOMA/Scripting/cColor"

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Jump to navigation Jump to search
 
Line 42: Line 42:
  
 
Read [http://stackoverflow.com/questions/12524623/what-are-the-practical-differences-when-working-with-colors-in-a-linear-vs-a-no this post on StackOverflow] for an explanation on the differences between the linear color space and the sRGB color space.
 
Read [http://stackoverflow.com/questions/12524623/what-are-the-practical-differences-when-working-with-colors-in-a-linear-vs-a-no this post on StackOverflow] for an explanation on the differences between the linear color space and the sRGB color space.
 +
 +
{{ReferencesSection}}
  
 
{{HPL3SOMAScriptingCategories}}
 
{{HPL3SOMAScriptingCategories}}
 
__FORCETOC__
 
__FORCETOC__

Latest revision as of 14:25, 6 August 2020

A four-channel color unit which stores float-based RGBA data. Color channel values are stored using a 0.0 - 1.0 range.

Constructors

Constructor Description
cColor() Creates a color with a default value of opaque black.
cColor(float, float) Creates a color with the first parameter given to all the RGB values (the color will be a shade of grey) and the second parameter given to the alpha channel.
cColor(float, float, float) Creates an opaque color using the given values as RGB data.
cColor(float, float, float, float) Creates a color using the given values as RGBA data.

Fields

Field Name Type Description
r float The value of the red channel.
g float The value of the green channel.
b float The value of the blue channel.
a float The value of the alpha channel.

Functions

Return Type Function Name Parameters Description
cColor ToLinearSpace const float afPower,
const bool abCorrectAlpha,
const
Returns the color converted into the linear space. (See remarks.)
cColor ToSRGB const bool abCorrectAlpha,
const
Returns the color converted into the sRGB space. (See remarks.

Remarks

Read this post on StackOverflow for an explanation on the differences between the linear color space and the sRGB color space.

References

See all references...