|
|
|
@ -10,6 +10,7 @@ using Xunit; |
|
|
|
namespace SixLabors.ImageSharp.Tests |
|
|
|
{ |
|
|
|
using System; |
|
|
|
using System.Numerics; |
|
|
|
|
|
|
|
public class DrawImageTest : FileTestBase |
|
|
|
{ |
|
|
|
@ -45,6 +46,25 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Normal)] |
|
|
|
public void ImageShouldDrawTransformedImage<TPixel>(TestImageProvider<TPixel> provider, PixelBlenderMode mode) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
|
using (Image<TPixel> blend = Image.Load<TPixel>(TestFile.Create(TestImages.Bmp.Car).Bytes)) |
|
|
|
{ |
|
|
|
Matrix3x2 rotate = Matrix3x2Extensions.CreateRotationDegrees(45F); |
|
|
|
Matrix3x2 scale = Matrix3x2Extensions.CreateScale(new SizeF(.25F, .25F)); |
|
|
|
|
|
|
|
blend.Mutate(x => x.Transform(rotate * scale)); |
|
|
|
|
|
|
|
var position = new Point((image.Width - blend.Width) / 2, (image.Height - blend.Height) / 2); |
|
|
|
image.Mutate(x => x.DrawImage(blend, mode, .75F, new Size(blend.Width, blend.Height), position)); |
|
|
|
image.DebugSave(provider, new[] { "Transformed" }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithSolidFilledImages(100, 100, 255, 255, 255, PixelTypes.Rgba32)] |
|
|
|
public void ImageShouldHandleNegativeLocation(TestImageProvider<Rgba32> provider) |
|
|
|
|