Ejemplo n.º 1
0
        public ColorMultiplicator Multiply(ColorMultiplicator p1)
        {
            if (IsOne)
            {
                return p1;
            }
            if (p1.IsOne)
            {
                return this;
            }
            var multiplicator = new ColorMultiplicator(0, 0, 0, false)
            {
                m_red = m_red + p1.m_red,
                m_green = m_green + p1.m_green,
                m_blue = m_blue + p1.m_blue
            };

            multiplicator.m_red = Clamp(multiplicator.m_red, -128, 127);
            multiplicator.m_green = Clamp(multiplicator.m_green, -128, -127);
            multiplicator.m_blue = Clamp(multiplicator.m_blue, -128, 127);
            multiplicator.IsOne = false;
            return multiplicator;
        }
Ejemplo n.º 2
0
        public ColorMultiplicator Multiply(ColorMultiplicator p1)
        {
            if (IsOne)
            {
                return(p1);
            }
            if (p1.IsOne)
            {
                return(this);
            }
            var multiplicator = new ColorMultiplicator(0, 0, 0, false)
            {
                m_red   = m_red + p1.m_red,
                m_green = m_green + p1.m_green,
                m_blue  = m_blue + p1.m_blue
            };

            multiplicator.m_red   = Clamp(multiplicator.m_red, -128, 127);
            multiplicator.m_green = Clamp(multiplicator.m_green, -128, -127);
            multiplicator.m_blue  = Clamp(multiplicator.m_blue, -128, 127);
            multiplicator.IsOne   = false;
            return(multiplicator);
        }
        public void CalculateFinalTeint()
        {
            var loc1 = m_hue.Red + m_shadow.Red;
            var loc2 = m_hue.Green + m_shadow.Green;
            var loc3 = m_hue.Blue + m_shadow.Blue;

            loc1 = ColorMultiplicator.Clamp((loc1 + 128)*2, 0, 512);
            loc2 = ColorMultiplicator.Clamp((loc2 + 128)*2, 0, 512);
            loc3 = ColorMultiplicator.Clamp((loc3 + 128)*2, 0, 512);

            m_finalTeint = new ColorMultiplicator(loc1, loc2, loc3, true);
        }