Esempio n. 1
0
        public void Test_Value()
        {
            ColorMatrix matrix = new ColorMatrix(2);

            matrix.SetValue(0, 0, 1.5);
            Assert.AreEqual(1.5, matrix.GetValue(0, 0));

            Assert.AreEqual(0.0, matrix.GetValue(0, 1));
            Assert.AreEqual(0.0, matrix.GetValue(1, 0));
        }
Esempio n. 2
0
        public static ColorMatrix Colors(this WriteableBitmap bitmap)
        {
            var colors = new ColorMatrix(bitmap.PixelHeight.UInt32(), bitmap.PixelWidth.UInt32());

            bitmap.ForEach((x, y, color) =>
            {
                colors.SetValue(y.UInt32(), x.UInt32(), color);
                return(color);
            });
            return(colors);
        }
Esempio n. 3
0
        public Effect AddTint(Color pColor)
        {
            var e = new ColorMatrix(_context);
            var m = new SharpDX.Mathematics.Interop.RawMatrix5x4();

            m.M11 = pColor.R * (pColor.A / 255f); //TODO this isn't working
            m.M12 = pColor.G * (pColor.A / 255f);
            m.M13 = pColor.B * (pColor.A / 255f);
            m.M14 = 1;
            e.SetValue(0, m);
            _effects.Add(e);
            return(this);
        }