예제 #1
0
            public void ReturnsExpectedValue()
            {
                var bitmap  = new Bitmap(10, 10);
                var adapter = new BitmapAdapter(bitmap);

                Assert.AreEqual(bitmap.Height, adapter.Height);
            }
예제 #2
0
    public override void SetPixel(int x, int y, ColorRgba32 color)
    {
        _directImage.SetPixel(x + _viewX, y + _viewY, color);

        if (_activePencilHistory.ModifiedPoints.Add(new Point(x, y)))
        {
            IsModified = true;
            BitmapAdapter.Invalidate(x, y, 1, 1);
        }
    }
예제 #3
0
            public void ReturnsExpectedValue()
            {
                var color  = Color.FromArgb(255, 255, 235, 205);
                var bitmap = new Bitmap(10, 10);

                bitmap.SetPixel(5, 7, color);

                var adapter = new BitmapAdapter(bitmap);

                Assert.AreEqual(color, adapter.GetPixel(5, 7));
            }
예제 #4
0
            private static void ColorConverted(Color startColor, Color destinationColor)
            {
                // TODO: Need to moq here, but it's difficult...
                var bitmap = new Bitmap(1, 1);

                bitmap.SetPixel(0, 0, startColor);
                var image = new BitmapAdapter(bitmap);

                var itemizer  = new GifItemizer();
                var inventory = itemizer.Itemize <PercentagePaletteInventory>(image);

                Assert.IsTrue(inventory.Items.ContainsKey(destinationColor));
            }
예제 #5
0
            public void NoError()
            {
                var color  = Color.FromArgb(255, 153, 213, 255);
                var bitmap = new Bitmap(1, 1);

                bitmap.SetPixel(0, 0, color);
                var adapter = new BitmapAdapter(bitmap);

                using (var stream = new MemoryStream())
                {
                    adapter.Save(stream, ImageFormat.Gif);
                    var newBitmap = new Bitmap(stream);
                    Assert.AreEqual(color, newBitmap.GetPixel(0, 0));
                }
            }
예제 #6
0
    public override void ApplyPaste(ArrangerPaste paste)
    {
        var notifyEvent = ApplyPasteInternal(paste).Match(
            success =>
        {
            AddHistoryAction(new PasteArrangerHistoryAction(Paste));

            IsModified = true;
            CancelOverlay();
            BitmapAdapter.Invalidate();

            return(new NotifyOperationEvent("Paste successfully applied"));
        },
            fail => new NotifyOperationEvent(fail.Reason)
            );

        _events.PublishOnUIThread(notifyEvent);
    }
예제 #7
0
 public override void Render() => BitmapAdapter.Invalidate();