- More ImRaii
- Cleanup - Spanish, French, Dutch, Chinese loc update
This commit is contained in:
@@ -4,7 +4,8 @@ using System.Numerics;
|
||||
namespace ChatTwo.Util;
|
||||
|
||||
internal static class ColourUtil {
|
||||
internal static (byte r, byte g, byte b, byte a) RgbaToComponents(uint rgba) {
|
||||
internal static (byte r, byte g, byte b, byte a) RgbaToComponents(uint rgba)
|
||||
{
|
||||
var r = (byte) ((rgba & 0xFF000000) >> 24);
|
||||
var g = (byte) ((rgba & 0xFF0000) >> 16);
|
||||
var b = (byte) ((rgba & 0xFF00) >> 8);
|
||||
@@ -14,12 +15,14 @@ internal static class ColourUtil {
|
||||
|
||||
internal static uint RgbaToAbgr(uint rgba) => BinaryPrimitives.ReverseEndianness(rgba);
|
||||
|
||||
internal static Vector3 RgbaToVector3(uint rgba) {
|
||||
internal static Vector3 RgbaToVector3(uint rgba)
|
||||
{
|
||||
var (r, g, b, _) = RgbaToComponents(rgba);
|
||||
return new Vector3((float) r / 255, (float) g / 255, (float) b / 255);
|
||||
}
|
||||
|
||||
internal static uint Vector3ToRgba(Vector3 col) {
|
||||
internal static uint Vector3ToRgba(Vector3 col)
|
||||
{
|
||||
return ComponentsToRgba(
|
||||
(byte) Math.Round(col.X * 255),
|
||||
(byte) Math.Round(col.Y * 255),
|
||||
@@ -27,7 +30,8 @@ internal static class ColourUtil {
|
||||
);
|
||||
}
|
||||
|
||||
internal static uint Vector4ToAbgr(Vector4 col) {
|
||||
internal static uint Vector4ToAbgr(Vector4 col)
|
||||
{
|
||||
return RgbaToAbgr(ComponentsToRgba(
|
||||
(byte) Math.Round(col.X * 255),
|
||||
(byte) Math.Round(col.Y * 255),
|
||||
|
||||
Reference in New Issue
Block a user