WriteableBitmapEx icon indicating copy to clipboard operation
WriteableBitmapEx copied to clipboard

Strange compression/deformation when drawing concentric circles

Open chris-crowther opened this issue 3 years ago • 1 comments

Thanks for the excellent library!

When drawing concentric circles on a wide image using DrawEllipseCentered the outer circles appear compressed/deformed.

using (writeableBitmap.GetBitmapContext())
{
    var centreX = (int) (writeableBitmap.Width / 2D);
    var centreY = (int) (writeableBitmap.Height / 2D);
    
    for (int i = 1; i <= 100; i++)
    {
        var radius = i * 50;
        writeableBitmap.DrawEllipseCentered(centreX, centreY, radius, radius, ConvertColor(Colors.Red));
    }
}

The bitmap is passed to a WPF image control with Stretch="None".

image

chris-crowther avatar May 09 '22 15:05 chris-crowther

The bigger circles are not even drawn: image

After changing all the ints to long in DrawEllipseCentered: image

I changed the following: image

(I don't know how this type change affects the performance... on a 64 bit CPU it should not be a problem)

NOTE: My screenshots are scaled.. in the original size they are perfect circles.

zgabi avatar Jul 01 '22 13:07 zgabi