Add Color.from_rgba8 and deprecate Color8
This commit is contained in:
@@ -177,6 +177,22 @@
|
||||
[/codeblocks]
|
||||
</description>
|
||||
</method>
|
||||
<method name="from_rgba8" qualifiers="static">
|
||||
<return type="Color" />
|
||||
<param index="0" name="r8" type="int" />
|
||||
<param index="1" name="g8" type="int" />
|
||||
<param index="2" name="b8" type="int" />
|
||||
<param index="3" name="a8" type="int" default="255" />
|
||||
<description>
|
||||
Returns a [Color] constructed from red ([param r8]), green ([param g8]), blue ([param b8]), and optionally alpha ([param a8]) integer channels, each divided by [code]255.0[/code] for their final value.
|
||||
[codeblock]
|
||||
var red = Color.from_rgba8(255, 0, 0) # Same as Color(1, 0, 0).
|
||||
var dark_blue = Color.from_rgba8(0, 0, 51) # Same as Color(0, 0, 0.2).
|
||||
var my_color = Color.from_rgba8(306, 255, 0, 102) # Same as Color(1.2, 1, 0, 0.4).
|
||||
[/codeblock]
|
||||
[b]Note:[/b] Due to the lower precision of [method from_rgba8] compared to the standard [Color] constructor, a color created with [method from_rgba8] will generally not be equal to the same color created with the standard [Color] constructor. Use [method is_equal_approx] for comparisons to avoid issues with floating-point precision error.
|
||||
</description>
|
||||
</method>
|
||||
<method name="from_rgbe9995" qualifiers="static">
|
||||
<return type="Color" />
|
||||
<param index="0" name="rgbe" type="int" />
|
||||
|
||||
Reference in New Issue
Block a user