Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
IntColor Class Reference

Static Public Member Functions

static Color32 FromLong (long i)
 
static long ToLong (ref Color c)
 
static Color32 FromInt (int i)
 
static int ToInt (ref Color c)
 
static int ToInt (Color c)
 

Detailed Description

Definition at line 3 of file IntColor.cs.

Member Function Documentation

◆ FromInt()

static Color32 IntColor.FromInt ( int  i)
inlinestatic

Definition at line 15 of file IntColor.cs.

16 {
17 byte b = (byte)(i / 4194304 * 2);
18 byte b2 = (byte)(i % 4194304 / 32768 * 2);
19 byte b3 = (byte)(i % 32768 / 256 * 2);
20 byte a = (byte)(i % 256);
21 return new Color32((byte)Mathf.Min(b + ((b % 2 != 0) ? 1 : 2), 255), (byte)Mathf.Min(b2 + ((b2 % 2 != 0) ? 1 : 2), 255), (byte)Mathf.Min(b3 + ((b3 % 2 != 0) ? 1 : 2), 255), a);
22 }

Referenced by LayerEditPortrait.Activate(), LayerPixelPaint.OnInit(), LayerEditHouse.RefreshBlockList(), Lot.RefreshData(), Portrait.SetChara(), and UIColorPicker.SetColor().

◆ FromLong()

static Color32 IntColor.FromLong ( long  i)
inlinestatic

Definition at line 5 of file IntColor.cs.

6 {
7 return new Color32((byte)(i / 16777216), (byte)(i % 16777216 / 65536), (byte)(i % 65536 / 256), (byte)(i % 256));
8 }

◆ ToInt() [1/2]

static int IntColor.ToInt ( Color  c)
inlinestatic

Definition at line 29 of file IntColor.cs.

30 {
31 return (int)(c.r * 127f) * 4194304 + (int)(c.g * 127f) * 32768 + (int)(c.b * 127f) * 256 + (int)(c.a * 255f);
32 }

◆ ToInt() [2/2]

static int IntColor.ToInt ( ref Color  c)
inlinestatic

Definition at line 24 of file IntColor.cs.

25 {
26 return (int)(c.r * 127f) * 4194304 + (int)(c.g * 127f) * 32768 + (int)(c.b * 127f) * 256 + (int)(c.a * 255f);
27 }

Referenced by LayerEditPortrait.Activate(), LayerEditPCC.Apply(), LayerPixelPaint.OnInit(), LayerEditHouse.RefreshBlockList(), Lot.RefreshData(), Lot.SetBaseRoom(), and UIColorPicker.SetColor().

◆ ToLong()

static long IntColor.ToLong ( ref Color  c)
inlinestatic

Definition at line 10 of file IntColor.cs.

11 {
12 return (int)c.r * 255 * 16777216 + (int)c.g * 255 * 65536 + (int)c.b * 255 * 256 + (int)(c.a * 255f);
13 }

The documentation for this class was generated from the following file: