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

Created Unassigned: Blit gives inconsistent results when enlarging [21275]

$
0
0
If I call Blit with a target rectangle that's exactly 3x the size of the source rectangle, I would expect the result to contain consistent, blocky, 3x3 "pixels". Instead, I get a crazy mishmash of 2x2, 2x3, 2x4, 3x2, 3x3, 3x4, 4x2, 4x3, and 4x4 "pixels" in the output.

Repro (using the latest NuGet package, 1.0.12.0):

var source = BitmapFactory.New(8, 8);
// Generate a checkerboard of pixels
for (var y = 0; y < source.Height; ++y)
for (var x = 0; x < source.Width; ++x)
source.SetPixel(x, y, ((x ^ y) & 1) == 1 ? Colors.Black : Colors.White);
// Enlarge to 3x
var target = BitmapFactory.New(source.PixelWidth * 3, source.PixelHeight * 3);
target.Blit(new Rect(0, 0, target.Width, target.Height), source,
new Rect(0, 0, source.Width, source.Height));
// Display the result
MyImage.Source = target;

Expected: a nice even checkerboard. Every square in the output should be 3 pixels wide and 3 pixels tall.

Actual: the row heights are 3, 4, 2, 3, 4, 3, 3, 2. Same kind of crazy variation on column widths. See attachment.

Viewing all articles
Browse latest Browse all 360

Trending Articles



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