Exemplo n.º 1
0
        public static ColorB Add(this ColorB color, byte value)
        {
#if OnUnity
            return(new ColorB(
                       (byte)(Mathf.Clamp((int)color.r + value, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.g + value, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.b + value, 0, 255)),
                       color.a));
#else
            return(ColorB.FromArgb(
                       color.A,
                       (byte)(Mathf.Clamp((int)color.R + value, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.G + value, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.B + value, 0, 255))));
#endif
        }
Exemplo n.º 2
0
        public static ColorB Add(this ColorB color, float value)
        {
            byte byteValue = (byte)(value * 255f);

#if OnUnity
            return(new ColorB(
                       (byte)(Mathf.Clamp((int)color.r + byteValue, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.g + byteValue, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.b + byteValue, 0, 255)),
                       color.a));
#else
            return(ColorB.FromArgb(
                       color.A,
                       (byte)(Mathf.Clamp((int)color.R + byteValue, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.G + byteValue, 0, 255)),
                       (byte)(Mathf.Clamp((int)color.B + byteValue, 0, 255))));
#endif
        }