Пример #1
0
        public void encode(Bitmap src)
        {
            if (src == null)
            {
                return;
            }
            if (activeFrom != null)
            {
                activeFrom.BeginInvoke(new formChange(setEnable), false);
            }
            if (monitor != null)
            {
                monitor.start();
            }
            BitmapData srcData = src.LockBits(MyF.bound(src), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            Thread     threadR = new Thread(new ThreadStart(new Action(() => {
                buildR(srcData);
            })));
            Thread threadD = new Thread(new ThreadStart(new Action(() => {
                buildD(srcData);
            })));

            threadD.Start();
            threadR.Start();
            threadR.Join();
            threadD.Join();
            src.UnlockBits(srcData);

            if (monitor != null)
            {
                monitor.OnValueChanged(new ValueEventArgs()
                {
                    value = 0.1
                });
            }

            findMatch(out file);
            if (monitor != null)
            {
                monitor.fine();
            }
            if (activeFrom != null)
            {
                activeFrom.BeginInvoke(new formChange(saveFile), true);
            }
        }