Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

Commented Unassigned: AAWidthLine IndexOutOfRange [22063]

$
0
0
WriteableBitmapEx Version 1.5.0, WinRT Windows running on W10

The following code produces IndexOutOfRangeException
bitmap extent [w=1737, h=3855], color is black FF000000

int height = context.Bitmap.PixelHeight; // = 1737
int width = context.Bitmap.PixelWidth; // = 3855
!==> context.Bitmap.DrawLineAa(0, height - 1, width / 2, height - 1, color, 2);

at Windows.UI.Xaml.Media.Imaging.WriteableBitmapExtensions.AAWidthLine(Int32 width, Int32 height, BitmapContext context, Single x1, Single y1, Single x2, Single y2, Single lineWidth, Int32 color)
at Windows.UI.Xaml.Media.Imaging.WriteableBitmapExtensions.DrawLineAa(WriteableBitmap bmp, Int32 x1, Int32 y1, Int32 x2, Int32 y2, Color color, Int32 strokeThickness)
Comments: ** Comment from web user: mneumann **

I've reproduced it with the following parameter / call:
DrawLineAa(WriteableBitmap(W:2000 x H:1324), 304, 1324, 225, 1324, #FF0000FF, 5)

I see that the y1, y2 are outside the bitmap. However, I expect the line to be properly clipped
or as the second best solution an informative exception to be thrown.
Without source code I was only guessing and never came behind the cause.
```
Method AADrawLine()
{
...
if (y1 == y2)
{
...
// x = 225
// y = 1324
// w = 2000
// buffer.Length = 2648000
// y * width + x = 2648225
// it looks like it goes one line down outside of the bitmap
d = buffer[y * width + x]; // crash here
}
}
```


Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>