Beispiel #1
0
        public void TestDrawVerticalLine()
        {
            var image = new IndexedImage {
                Size = new Size(5, 5)
            };

            ImagePainter.DrawVerticalLine(image, 1, 1, 5, 1, 2);
            AssertImage(
                new[]
            {
                0, 0, 0, 0, 0,
                0, 1, 1, 0, 0,
                0, 1, 1, 0, 0,
                0, 1, 1, 0, 0,
                0, 1, 1, 0, 0
            },
                image);

            ImagePainter.DrawVerticalLine(image, 3, 0, 4, 2, 1);
            AssertImage(
                new[]
            {
                0, 0, 0, 2, 0,
                0, 1, 1, 2, 0,
                0, 1, 1, 2, 0,
                0, 1, 1, 2, 0,
                0, 1, 1, 0, 0
            },
                image);
        }
Beispiel #2
0
        void IPainter.DrawVerticalLine(int x, int y, int length, int argb, int width)
        {
            x += Shift.Width;
            y += Shift.Height;

            if (x >= ClipRect.Left && x < ClipRect.RightExclusive)
            {
                y      = Math.Max(y, ClipRect.Top);
                length = Math.Min(length, ClipRect.BottomExclusive - y);
                if (length > 0)
                {
                    ImagePainter.DrawVerticalLine(Canvas, x, y, length, argb, SupportLineWidth ? width : 1);
                }
            }
        }