public Color(LinearColor color) { R = WMath.Clamp((byte)SMath.Truncate(SMath.Pow(color.R, Constants.ONE_OVER_TWO_TWO) * 255.0f), (byte)0, (byte)255); G = WMath.Clamp((byte)SMath.Truncate(SMath.Pow(color.G, Constants.ONE_OVER_TWO_TWO) * 255.0f), (byte)0, (byte)255); B = WMath.Clamp((byte)SMath.Truncate(SMath.Pow(color.B, Constants.ONE_OVER_TWO_TWO) * 255.0f), (byte)0, (byte)255); A = WMath.Clamp((byte)SMath.Truncate(color.A * 255.0f), (byte)0, (byte)255); }
public LinearColor(LinearColor color) { _a = color._a; _r = color._r; _g = color._g; _b = color._b; }
public bool Equals(LinearColor other, float tolerance = Constants.NUMBER_PRETTY_SMALL) { if ((object)other == null) { return false; } return (SMath.Abs(A - other.A) < tolerance) && (SMath.Abs(R - other.R) < tolerance) && (SMath.Abs(G - other.G) < tolerance) && (SMath.Abs(B - other.B) < tolerance); }
public static LinearColor Lerp(LinearColor x, LinearColor y, float alpha) { return x + alpha * (y - x); }
public static float EvaluateBezier(LinearColor[] controlPoints, out List<LinearColor> points) { throw new NotImplementedException(); }
public static float Distance(LinearColor x, LinearColor y) { return (float)SMath.Sqrt(WMath.Square(y.R - x.R) + WMath.Square(y.G - x.G) + WMath.Square(y.B - x.B) + WMath.Square(y.A - x.A)); }
public static unsafe void WriteLinearColorRGBA(byte[] buffer, ref int offset, LinearColor value) { WriteFloat(buffer, ref offset, value.R); WriteFloat(buffer, ref offset, value.G); WriteFloat(buffer, ref offset, value.B); WriteFloat(buffer, ref offset, value.A); }