Browse Source

Crop

pull/232/head
James Jackson-South 9 years ago
parent
commit
e450f85c64
  1. 1
      src/ImageSharp/Processing/Transforms/AutoOrient.cs
  2. 26
      tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs
  3. 31
      tests/ImageSharp.Tests/Processors/Filters/CropTest.cs

1
src/ImageSharp/Processing/Transforms/AutoOrient.cs

@ -5,7 +5,6 @@
namespace ImageSharp
{
using ImageSharp.PixelFormats;
using ImageSharp.Processing;

26
tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs

@ -0,0 +1,26 @@
// <copyright file="CropTest.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Tests.Processing.Transforms
{
using ImageSharp.PixelFormats;
using Xunit;
public class CropTest : FileTestBase
{
[Theory]
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)]
public void ImageShouldCrop<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
{
image.Crop(image.Width / 2, image.Height / 2)
.DebugSave(provider, null, Extensions.Bmp);
}
}
}
}

31
tests/ImageSharp.Tests/Processors/Filters/CropTest.cs

@ -1,31 +0,0 @@
// <copyright file="CropTest.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Tests
{
using System.IO;
using ImageSharp.PixelFormats;
using Xunit;
public class CropTest : FileTestBase
{
[Fact]
public void ImageShouldApplyCropSampler()
{
string path = this.CreateOutputDirectory("Crop");
foreach (TestFile file in Files)
{
using (Image<Rgba32> image = file.CreateImage())
using (FileStream output = File.OpenWrite($"{path}/{file.FileName}"))
{
image.Crop(image.Width / 2, image.Height / 2).Save(output);
}
}
}
}
}
Loading…
Cancel
Save