Browse Source

So many nulls!

pull/480/head
James Jackson-South 8 years ago
parent
commit
64c50e257f
  1. 14
      src/ImageSharp/Image/Image.FromBytes.cs
  2. 11
      src/ImageSharp/Image/Image.FromFile.cs

14
src/ImageSharp/Image/Image.FromBytes.cs

@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp
/// <returns>The format or null if none found.</returns>
public static IImageFormat DetectFormat(byte[] data)
{
return DetectFormat(null, data);
return DetectFormat(Configuration.Default, data);
}
/// <summary>
@ -41,7 +41,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="data">The byte array containing image data.</param>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
public static Image<Rgba32> Load(byte[] data) => Load<Rgba32>(null, data);
public static Image<Rgba32> Load(byte[] data) => Load<Rgba32>(Configuration.Default, data);
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp
/// <param name="data">The byte array containing image data.</param>
/// <param name="format">The mime type of the decoded image.</param>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
public static Image<Rgba32> Load(byte[] data, out IImageFormat format) => Load<Rgba32>(null, data, out format);
public static Image<Rgba32> Load(byte[] data, out IImageFormat format) => Load<Rgba32>(Configuration.Default, data, out format);
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
@ -93,9 +93,7 @@ namespace SixLabors.ImageSharp
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
public static Image<TPixel> Load<TPixel>(byte[] data)
where TPixel : struct, IPixel<TPixel>
{
return Load<TPixel>(null, data);
}
=> Load<TPixel>(Configuration.Default, data);
/// <summary>
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
@ -106,9 +104,7 @@ namespace SixLabors.ImageSharp
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
public static Image<TPixel> Load<TPixel>(byte[] data, out IImageFormat format)
where TPixel : struct, IPixel<TPixel>
{
return Load<TPixel>(null, data, out format);
}
=> Load<TPixel>(Configuration.Default, data, out format);
/// <summary>
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.

11
src/ImageSharp/Image/Image.FromFile.cs

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp
/// <returns>The mime type or null if none found.</returns>
public static IImageFormat DetectFormat(string filePath)
{
return DetectFormat(null, filePath);
return DetectFormat(Configuration.Default, filePath);
}
/// <summary>
@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp
public static Image<TPixel> Load<TPixel>(string path)
where TPixel : struct, IPixel<TPixel>
{
return Load<TPixel>(null, path);
return Load<TPixel>(Configuration.Default, path);
}
/// <summary>
@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp
public static Image<TPixel> Load<TPixel>(string path, out IImageFormat format)
where TPixel : struct, IPixel<TPixel>
{
return Load<TPixel>(null, path, out format);
return Load<TPixel>(Configuration.Default, path, out format);
}
/// <summary>
@ -150,7 +150,6 @@ namespace SixLabors.ImageSharp
public static Image<TPixel> Load<TPixel>(Configuration config, string path)
where TPixel : struct, IPixel<TPixel>
{
config = config ?? Configuration.Default;
using (Stream stream = config.FileSystem.OpenRead(path))
{
return Load<TPixel>(config, stream);
@ -171,7 +170,6 @@ namespace SixLabors.ImageSharp
public static Image<TPixel> Load<TPixel>(Configuration config, string path, out IImageFormat format)
where TPixel : struct, IPixel<TPixel>
{
config = config ?? Configuration.Default;
using (Stream stream = config.FileSystem.OpenRead(path))
{
return Load<TPixel>(config, stream, out format);
@ -191,7 +189,7 @@ namespace SixLabors.ImageSharp
public static Image<TPixel> Load<TPixel>(string path, IImageDecoder decoder)
where TPixel : struct, IPixel<TPixel>
{
return Load<TPixel>(null, path, decoder);
return Load<TPixel>(Configuration.Default, path, decoder);
}
/// <summary>
@ -208,7 +206,6 @@ namespace SixLabors.ImageSharp
public static Image<TPixel> Load<TPixel>(Configuration config, string path, IImageDecoder decoder)
where TPixel : struct, IPixel<TPixel>
{
config = config ?? Configuration.Default;
using (Stream stream = config.FileSystem.OpenRead(path))
{
return Load<TPixel>(config, stream, decoder);

Loading…
Cancel
Save