Exemplo n.º 1
0
        /// Return color packed to a 32-bit integer, with B component in the lowest 8 bits. Components are clamped to [0, 1] range.
        public uint ToUIntArgb()
        {
            uint r = (uint)MathDefs.Clamp(((int)(R * 255.0f)), 0, 255);
            uint g = (uint)MathDefs.Clamp(((int)(G * 255.0f)), 0, 255);
            uint b = (uint)MathDefs.Clamp(((int)(B * 255.0f)), 0, 255);
            uint a = (uint)MathDefs.Clamp(((int)(A * 255.0f)), 0, 255);

            return((a << 24) | (r << 16) | (g << 8) | b);
        }
Exemplo n.º 2
0
        /// Return color packed to a 32-bit integer, with R component in the lowest 8 bits. Components are clamped to [0, 1] range.
        public uint ToUInt()
        {
            var r = (uint)MathDefs.Clamp(((int)(R * 255.0f)), 0, 255);
            var g = (uint)MathDefs.Clamp(((int)(G * 255.0f)), 0, 255);
            var b = (uint)MathDefs.Clamp(((int)(B * 255.0f)), 0, 255);
            var a = (uint)MathDefs.Clamp(((int)(A * 255.0f)), 0, 255);

            return((a << 24) | (b << 16) | (g << 8) | r);
        }