mirror of https://github.com/SixLabors/ImageSharp
6 changed files with 240 additions and 1 deletions
@ -0,0 +1,34 @@ |
|||||
|
namespace ImageSharp.Benchmarks.Color |
||||
|
{ |
||||
|
using BenchmarkDotNet.Attributes; |
||||
|
|
||||
|
using Colourful; |
||||
|
using Colourful.Conversion; |
||||
|
|
||||
|
using ImageSharp.Colors.Spaces; |
||||
|
using ImageSharp.Colors.Spaces.Conversion; |
||||
|
|
||||
|
public class RgbWorkingSpaceAdapt |
||||
|
{ |
||||
|
private static readonly Rgb Rgb = new Rgb(0.206162F, 0.260277F, 0.746717F, RgbWorkingSpaces.WideGamutRgb); |
||||
|
|
||||
|
private static readonly RGBColor RGBColor = new RGBColor(0.206162, 0.260277, 0.746717, RGBWorkingSpaces.WideGamutRGB); |
||||
|
|
||||
|
private static readonly ColorSpaceConverter ColorSpaceConverter = new ColorSpaceConverter { TargetRgbWorkingSpace = RgbWorkingSpaces.SRgb }; |
||||
|
|
||||
|
private static readonly ColourfulConverter ColourfulConverter = new ColourfulConverter { TargetRGBWorkingSpace = RGBWorkingSpaces.sRGB }; |
||||
|
|
||||
|
|
||||
|
[Benchmark(Baseline = true, Description = "Colourful Adapt")] |
||||
|
public RGBColor ColourfulConvert() |
||||
|
{ |
||||
|
return ColourfulConverter.Adapt(RGBColor); |
||||
|
} |
||||
|
|
||||
|
[Benchmark(Description = "ImageSharp Adapt")] |
||||
|
public Rgb ColorSpaceConvert() |
||||
|
{ |
||||
|
return ColorSpaceConverter.Adapt(Rgb); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<configuration> |
||||
|
<appSettings> |
||||
|
<add key="xunit.methodDisplay" value="method"/> |
||||
|
</appSettings> |
||||
|
</configuration> |
||||
Loading…
Reference in new issue