private static void Draw(Image <Rgba32> image, QrCodeBlock qrCodeBlock) { CoreRectangle rectangle = new CoreRectangle( qrCodeBlock.Position.X1, qrCodeBlock.Position.Y1, qrCodeBlock.Position.Width, qrCodeBlock.Position.Height ); Rgba32 color = new Rgba32(qrCodeBlock.Color.Red, qrCodeBlock.Color.Green, qrCodeBlock.Color.Blue); image.Mutate(ctx => ctx.Fill(color, rectangle)); }
[InlineData(false, 16, 4)] // we always do 4 sub=pixels when antialising is off. public void MinimumAntialiasSubpixelDepth(bool antialias, int antialiasSubpixelDepth, int expectedAntialiasSubpixelDepth) { var bounds = new SixLabors.Primitives.Rectangle(0, 0, 1, 1); var brush = new Mock <IBrush <Rgba32> >(); var region = new Mock <Region>(); region.Setup(x => x.Bounds).Returns(bounds); var options = new GraphicsOptions(antialias) { AntialiasSubpixelDepth = 1 }; var processor = new FillRegionProcessor <Rgba32>(brush.Object, region.Object, options); var img = new Image <Rgba32>(1, 1); processor.Apply(img, bounds); region.Verify(x => x.Scan(It.IsAny <float>(), It.IsAny <float[]>(), It.IsAny <int>()), Times.Exactly(4)); }