Beispiel #1
0
        protected override void Dispose(bool disposing)
        {
            m_data.Dispose();
            m_pData.Free();

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            m_data.Dispose();
            m_pData.Free();

            if (disposing)
            {
                m_callbacks = null;
            }

            base.Dispose(disposing);
        }
Beispiel #3
0
        public void PixelDataConstructor()
        {
            tlog.Debug(tag, $"PixelDataConstructor START");

            byte[] buffer = new byte[1024];

            var testingTarget = new PixelData(buffer, 1024, 100, 150, PixelFormat.L8, PixelData.ReleaseFunction.Free);

            Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
            Assert.IsInstanceOf <PixelData>(testingTarget, "Should be an instance of PixelData type.");

            buffer = null;
            testingTarget.Dispose();
            tlog.Debug(tag, $"PixelDataConstructor END (OK)");
        }
Beispiel #4
0
        protected override void Dispose(bool disposing)
        {
            IntPtr zero = IntPtr.Zero;

            LibVlcMethods.libvlc_video_set_callbacks(m_hMediaPlayer, zero, zero, zero, zero);

            m_pixelDataPtr.Free();
            m_pixelData.Dispose();

            MemoryHeap.Free(m_pBuffer);

            if (disposing)
            {
                m_timer.Dispose();
                m_callback = null;
                m_callbacks.Clear();
            }
        }
Beispiel #5
0
        public void PixelDataConstructorByIntPtr()
        {
            tlog.Debug(tag, $"PixelDataConstructorByIntPtr START");

            byte[] buffer = new byte[10];

            using (PixelData pixelData = new PixelData(buffer, 10, 1, 2, PixelFormat.L8))
            {
                var testingTarget = new PixelData(PixelData.getCPtr(pixelData).Handle, true);
                Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
                Assert.IsInstanceOf <PixelData>(testingTarget, "Should be an instance of PixelData type.");

                testingTarget.Dispose();
            }

            buffer = null;
            tlog.Debug(tag, $"PixelDataConstructorByIntPtr END (OK)");
        }
Beispiel #6
0
        public void PixelGetWidth()
        {
            tlog.Debug(tag, $"PixelGetWidth START");

            byte[] buffer = new byte[10];

            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8, PixelData.ReleaseFunction.Free);

            Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
            Assert.IsInstanceOf <PixelData>(testingTarget, "Should be an instance of PixelData type.");

            var result = testingTarget.GetWidth();

            Assert.AreEqual(1, result, "Should be equal!");

            buffer = null;
            testingTarget.Dispose();
            tlog.Debug(tag, $"PixelGetWidth END (OK)");
        }
Beispiel #7
0
        public void PixelDataGenerateUrl()
        {
            tlog.Debug(tag, $"PixelDataGenerateUrl START");

            byte[] buffer = new byte[10];

            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);

            Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
            Assert.IsInstanceOf <PixelData>(testingTarget, "Should be an instance of PixelData type.");

            var result = testingTarget.GenerateUrl();

            Assert.IsNotNull(result);

            buffer = null;
            testingTarget.Dispose();
            tlog.Debug(tag, $"PixelDataGenerateUrl END (OK)");
        }
Beispiel #8
0
            public static PixelData LockBits(Bitmap image, Rectangle rect, ImageLockMode flags)
            {
                var format = PixelFormat.Format32bppArgb;

                if (image.PixelFormat != format)
                {
                    throw new Exception();
                }
                var bitmapData = image.LockBits(rect, flags, format);
                var data       = new PixelData(image, bitmapData);

                try
                {
                    data.Initialize();
                }
                catch
                {
                    data.Dispose();
                    throw;
                }
                return(data);
            }
Beispiel #9
0
        public void PixelDataGenerateUrl()
        {
            tlog.Debug(tag, $"PixelDataGenerateUrl START");

            uint width      = 64;
            uint height     = 64;
            uint bufferSize = width * height * 4;

            byte[] buffer = new byte[bufferSize];

            var testingTarget = new PixelData(buffer, bufferSize, width, height, PixelFormat.RGBA8888, PixelData.ReleaseFunction.Free);

            Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
            Assert.IsInstanceOf <PixelData>(testingTarget, "Should be an instance of PixelData type.");

            var result = testingTarget.GenerateUrl();

            Assert.IsNotNull(result);

            buffer = null;
            testingTarget.Dispose();
            tlog.Debug(tag, $"PixelDataGenerateUrl END (OK)");
        }