Beispiel #1
0
            public void Run()
            {
                Bitmap bitmap = null;

                try
                {
                    if (_decoder.CanProcessImage == null || !_decoder.CanProcessImage())
                    {
                        _backgroundHandler.Post(new ImageDecoder(_backgroundHandler, _surfaceView));
                        return;
                    }

                    bitmap = _surfaceView.GetBitmap(_decoder.ImageSizeX, _decoder.ImageSizeY);
                    var result = _decoder.Decode(bitmap);
                    bitmap.Recycle();
                    if (_decoder.FinishProcessImage(result))
                    {
                        return;
                    }
                }
                catch (System.Exception ex)
                {
                    bitmap?.Recycle();
                    _decoder.HandleExceptionFromProcessImage?.Invoke(ex);
                }

                _backgroundHandler.Post(new ImageDecoder(_backgroundHandler, _surfaceView));
            }