Browse Source

Move extension method back to Image<Pixel> to keep it public.

pull/326/head
Dirk Lemstra 9 years ago
parent
commit
46cf55094c
  1. 19
      src/ImageSharp/Advanced/IConfigurableExtensions.cs
  2. 18
      src/ImageSharp/Advanced/ImageExtensions.cs

19
src/ImageSharp/Advanced/IConfigurableExtensions.cs

@ -1,19 +0,0 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.Advanced
{
/// <summary>
/// Extension methods over <see cref="IConfigurable"/>
/// </summary>
internal static partial class IConfigurableExtensions
{
/// <summary>
/// Gets the configuration.
/// </summary>
/// <param name="self">The configurable</param>
/// <returns>Returns the configuration.</returns>
public static Configuration GetConfiguration(this IConfigurable self)
=> self?.Configuration ?? Configuration.Default;
}
}

18
src/ImageSharp/Advanced/ImageExtensions.cs

@ -38,6 +38,16 @@ namespace SixLabors.ImageSharp.Advanced
where TPixel : struct, IPixel<TPixel>
=> GetSpan(source, row);
/// <summary>
/// Gets the configuration.
/// </summary>
/// <typeparam name="TPixel">The Pixel format.</typeparam>
/// <param name="source">The source image</param>
/// <returns>Returns the configuration.</returns>
public static Configuration GetConfiguration<TPixel>(this Image<TPixel> source)
where TPixel : struct, IPixel<TPixel>
=> GetConfiguration(source);
/// <summary>
/// Gets the span.
/// </summary>
@ -73,5 +83,13 @@ namespace SixLabors.ImageSharp.Advanced
private static Span<TPixel> GetSpan<TPixel>(Buffer2D<TPixel> source, int row)
where TPixel : struct, IPixel<TPixel>
=> source.Span.Slice(row * source.Width, source.Width);
/// <summary>
/// Gets the configuration.
/// </summary>
/// <param name="source">The source image</param>
/// <returns>Returns the bounds of the image</returns>
private static Configuration GetConfiguration(IConfigurable source)
=> source?.Configuration ?? Configuration.Default;
}
}

Loading…
Cancel
Save