public void TestThatCopyToClipboardWithSelectionSavesCorrectBitmap()
        {
            Clipboard.Clear();

            Layer testLayer  = new Layer("test layer", 10, 10);
            Layer testLayer2 = new Layer("test layer", 10, 10);

            testLayer.SetPixel(new Coordinates(4, 4), testColor);
            testLayer2.SetPixel(new Coordinates(5, 5), testColor);

            ClipboardController.CopyToClipboard(new [] { testLayer, testLayer2 },
                                                new [] { new Coordinates(4, 4), new Coordinates(5, 5) }, 10, 10);

            var img = Clipboard.GetImage(); // Using default Clipboard get image to avoid false positives from faulty ClipboardController GetImage

            Assert.True(ClipboardController.IsImageInClipboard());
            Assert.NotNull(img);
            Assert.Equal(2, img.PixelWidth);
            Assert.Equal(2, img.PixelHeight);

            var bmp = new WriteableBitmap(img);

            Assert.Equal(testColor, bmp.GetPixel(0, 0));
            Assert.Equal(testColor, bmp.GetPixel(1, 1));
        }
        public void TestThatClipboardControllerSavesImageToClipboard()
        {
            Layer testLayer = new Layer("test layer", 10, 10);

            ClipboardController.CopyToClipboard(new [] { testLayer }, CoordinatesCalculator.RectangleToCoordinates(0, 0, 9, 9), 10, 10);
            Assert.True(ClipboardController.IsImageInClipboard());
        }
Example #3
0
 private void Copy(object parameter)
 {
     ClipboardController.CopyToClipboard(
         new[] { Owner.BitmapManager.ActiveDocument.ActiveLayer },
         Owner.BitmapManager.ActiveDocument.ActiveSelection.SelectedPoints.ToArray(),
         Owner.BitmapManager.ActiveDocument.Width,
         Owner.BitmapManager.ActiveDocument.Height);
 }
Example #4
0
 private void Copy(object parameter)
 {
     ClipboardController.CopyToClipboard(
         Owner.BitmapManager.ActiveDocument.Layers.Where(x => x.IsActive && x.IsVisible).ToArray(),
         Owner.BitmapManager.ActiveDocument.ActiveSelection.SelectedPoints.ToArray(),
         Owner.BitmapManager.ActiveDocument.Width,
         Owner.BitmapManager.ActiveDocument.Height);
 }
Example #5
0
        private void Copy(object parameter)
        {
            var doc = Owner.BitmapManager.ActiveDocument;

            ClipboardController.CopyToClipboard(
                doc.Layers.Where(x => x.IsActive && doc.GetFinalLayerIsVisible(x)).ToArray(),
                doc.ActiveSelection.SelectedPoints.ToArray(),
                doc.Width,
                doc.Height);
        }
 private void Copy(object parameter)
 {
     ClipboardController.CopyToClipboard(Owner.BitmapManager.ActiveDocument);
 }