private void ApplyFilter() { if (_polyPoints.Count == 4 && _firstPointSelected) { List <LeadPoint> PolyPoints = new List <LeadPoint>(); for (int i = 0; i < 4; i++) { PolyPoints.Add(new LeadPoint(_polyPoints[i].X, _polyPoints[i].Y)); } KeyStoneCommand command = new KeyStoneCommand(PolyPoints.ToArray()); try { command.Run(_viewer.Image); } catch (System.Exception ex) { Messager.ShowError(this, ex); return; } _viewer.Cursor = Cursors.Default; #if !LEADTOOLS_V20_OR_LATER _viewer.Image = command.TransformedBitmap.Clone(); #else _viewer.Image = command.TransformedImage.Clone(); #endif // #if !LEADTOOLS_V20_OR_LATER _viewer.Invalidate(); _firstPointSelected = false; _btnReset.Enabled = true; _btnApply.Enabled = false; } }
private void ApplyFilter() { if (_polyPoints.Count == 4 && _firstPointSelected) { _applied = true; LeadPoint[] PolyPoints = new LeadPoint[4]; for (int i = 0; i < 4; i++) { PolyPoints[i].X = _polyPoints[i].X; PolyPoints[i].Y = _polyPoints[i].Y; } _viewer.Image.MakeRegionEmpty(); KeyStoneCommand command = new KeyStoneCommand(PolyPoints); try { command.Run(_viewer.Image); } catch (System.Exception ex) { Messager.ShowError(this, ex); return; } _viewer.Cursor = Cursors.Default; #if !LEADTOOLS_V20_OR_LATER if (command.TransformedBitmap != null) { _viewer.Image = command.TransformedBitmap.Clone(); } #else if (command.TransformedImage != null) { _viewer.Image = command.TransformedImage.Clone(); } #endif // #if !LEADTOOLS_V20_OR_LATER _viewer.Invalidate(); _form.Invalidate(); _firstPointSelected = false; _btnReset.Enabled = true; _btnApply.Enabled = false; } }
public RasterImage ApplyDeskew() { if (ImageViewer == null || ImageViewer.ActiveItem.Image == null) { return(null); } LeadPoint[] polygonPoints = new LeadPoint[4]; polygonPoints[0] = TopLeft; polygonPoints[1] = TopRight; polygonPoints[2] = BottomRight; polygonPoints[3] = BottomLeft; KeyStoneCommand command = new KeyStoneCommand(polygonPoints); command.Run(ImageViewer.ActiveItem.Image); return(command.TransformedImage); }