/// <summary> /// Constructs the view model for a given <paramref name="textureAtlas"/> with a given <paramref name="colorType"/> /// </summary> /// <param name="textureAtlas">The texture atlas for which the view model should be created</param> /// <param name="colorType">The color type to be used</param> public TextureAtlasViewModel(TextureAtlas textureAtlas, SKColorType colorType = SKColorType.Rgba8888) { eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); this.textureAtlas = textureAtlas; this.colorType = colorType; TextureAtlasBitmap = new ImageViewModel(textureAtlas.GetImageWithColorType(this.colorType)); SelectedRectangles = new HashSet <PPRect>(); MouseClickPosition = new PPPoint(-1, -1); //make sure that upper left retangle is not selected in the beginning PropertyChanged += TextureAtlasViewModel_PropertyChanged; //Paint = new RelayCommand((args => //{ // using (SKPaint paint = new SKPaint()) // { // paint.IsAntialias = true; // var e = (SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs)args; // foreach (var selectedRectangle in SelectedRectangles) // { // e.Surface.Canvas.DrawRect(new SKRectI(selectedRectangle.Left, selectedRectangle.Top, selectedRectangle.Right, selectedRectangle.Bottom), paint); // } // e.Surface.Canvas.Clear(SKColors.Transparent); // } //}), (_) => true); }