mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
namespace ImageProcessorCore.Benchmarks.Image
|
|
{
|
|
using System.Drawing;
|
|
|
|
using BenchmarkDotNet.Attributes;
|
|
|
|
using CoreColor = ImageProcessorCore.Color;
|
|
using CoreImage = ImageProcessorCore.Image;
|
|
using SystemColor = System.Drawing.Color;
|
|
|
|
public class GetSetPixel
|
|
{
|
|
[Benchmark(Baseline = true, Description = "System.Drawing GetSet Pixel")]
|
|
public SystemColor ResizeSystemDrawing()
|
|
{
|
|
using (Bitmap source = new Bitmap(400, 400))
|
|
{
|
|
source.SetPixel(200, 200, SystemColor.White);
|
|
return source.GetPixel(200, 200);
|
|
}
|
|
}
|
|
|
|
[Benchmark(Description = "ImageProcessorCore GetSet Pixel")]
|
|
public CoreColor ResizeCore()
|
|
{
|
|
CoreImage image = new CoreImage(400, 400);
|
|
using (IPixelAccessor<CoreColor, uint> imagePixels = image.Lock())
|
|
{
|
|
imagePixels[200, 200] = CoreColor.White;
|
|
return imagePixels[200, 200];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|