public ApplicationController() { _cropService = new CropService(); _tendService = new TendService(); _gardenService = new GardenService(); }
protected override void Dispose(bool disposing) { if (disposing && farmService != null) { farmService.Dispose(); farmService = null; } if (disposing && cropService != null) { cropService.Dispose(); cropService = null; } }
public Bitmap GetBitmapCrop() { var cropArea = CropService.GetCroppedArea(); int X = (int)cropArea.CroppedRectAbsolute.X; int Y = (int)cropArea.CroppedRectAbsolute.Y; int Width = (int)cropArea.CroppedRectAbsolute.Width; int Height = (int)cropArea.CroppedRectAbsolute.Height; if (Width == 0 || Height == 0) { return(BitmapImageToBitmap(SourceBitmapImage)); } if (SourceBitmapImage.PixelHeight != SourceImage.ActualHeight || SourceBitmapImage.PixelWidth != SourceImage.ActualWidth) { float ratioH = (float)SourceImage.ActualHeight * 100 / (float)SourceBitmapImage.PixelHeight; float ratioW = (float)SourceImage.ActualWidth * 100 / (float)SourceBitmapImage.PixelWidth; Width = (int)(Width / ratioW * 100); Height = (int)(Height / ratioH * 100); X = (int)(X / ratioW * 100); Y = (int)(Y / ratioH * 100); } Rectangle cropRect = new Rectangle(X, Y, Width, Height); Bitmap target = new Bitmap(cropRect.Width, cropRect.Height, PixelFormat.Format32bppArgb); Bitmap SourceBitmap = BitmapImageToBitmap(SourceBitmapImage); using (Graphics g = Graphics.FromImage(target)) { g.DrawImage(SourceBitmap, new System.Drawing.Rectangle(0, 0, target.Width, target.Height), cropRect, GraphicsUnit.Pixel); } return(target); }
private void RootGrid_Loaded(object sender, RoutedEventArgs e) { CropService = new CropService(this); CropService.CroppedAreaChangedEvent += OnCroppedAreaChanged; }
public void SetCropAreaRatio(int rWidth, int rHeight) { CropService.SetCropAreaRatio(SourceImage.ActualWidth, SourceImage.ActualHeight, rWidth, rHeight); }
public void SetCropArea(double Width, double Height) { CropService.SetCropArea(Width, Height); }
public void SetKeepRatio(bool KeepRatio) { CropService.SetKeepRatio(KeepRatio); }
private void RootGrid_Loaded(object sender, RoutedEventArgs e) { CropService = new CropService(this); CropService.ShowText(_TextVisible); }
public AdminLteController() { farmService = new FarmService(); cropService = new CropService(); }
private void RootGrid_Loaded(object sender, RoutedEventArgs e) { CropService = new CropService(this, SquareSelection); }