|
|
|
@ -1,6 +1,7 @@ |
|
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using SixLabors.ImageSharp.Formats; |
|
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
|
@ -15,7 +16,7 @@ namespace SixLabors.ImageSharp |
|
|
|
/// <summary>
|
|
|
|
/// By reading the header on the provided byte array this calculates the images format.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte array containing image data to read the header from.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data to read the header from.</param>
|
|
|
|
/// <returns>The format or null if none found.</returns>
|
|
|
|
public static IImageFormat DetectFormat(byte[] data) |
|
|
|
{ |
|
|
|
@ -26,7 +27,7 @@ namespace SixLabors.ImageSharp |
|
|
|
/// By reading the header on the provided byte array this calculates the images format.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The configuration.</param>
|
|
|
|
/// <param name="data">The byte array containing image data to read the header from.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data to read the header from.</param>
|
|
|
|
/// <returns>The mime type or null if none found.</returns>
|
|
|
|
public static IImageFormat DetectFormat(Configuration config, byte[] data) |
|
|
|
{ |
|
|
|
@ -37,30 +38,30 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
|
|
|
|
/// </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>(Configuration.Default, data); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded 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>(Configuration.Default, data, out format); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The config for the decoder.</param>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
|
|
|
|
public static Image<Rgba32> Load(Configuration config, byte[] data) => Load<Rgba32>(config, data); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The config for the decoder.</param>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
@ -69,15 +70,15 @@ namespace SixLabors.ImageSharp |
|
|
|
public static Image<Rgba32> Load(Configuration config, byte[] data, out IImageFormat format) => Load<Rgba32>(config, data, out format); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <param name="decoder">The decoder.</param>
|
|
|
|
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
|
|
|
|
public static Image<Rgba32> Load(byte[] data, IImageDecoder decoder) => Load<Rgba32>(data, decoder); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The config for the decoder.</param>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
@ -86,9 +87,9 @@ namespace SixLabors.ImageSharp |
|
|
|
public static Image<Rgba32> Load(Configuration config, byte[] data, IImageDecoder decoder) => Load<Rgba32>(config, data, decoder); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(byte[] data) |
|
|
|
@ -96,7 +97,7 @@ namespace SixLabors.ImageSharp |
|
|
|
=> Load<TPixel>(Configuration.Default, data); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="format">The mime type of the decoded image.</param>
|
|
|
|
@ -107,10 +108,10 @@ namespace SixLabors.ImageSharp |
|
|
|
=> Load<TPixel>(Configuration.Default, data, out format); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The configuration options.</param>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(Configuration config, byte[] data) |
|
|
|
@ -123,11 +124,11 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The configuration options.</param>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="format">The mime type of the decoded image.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <param name="format">The <see cref="IImageFormat"/> of the decoded image.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(Configuration config, byte[] data, out IImageFormat format) |
|
|
|
@ -140,9 +141,9 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <param name="decoder">The decoder.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
@ -156,10 +157,10 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array.
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte array.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The Configuration.</param>
|
|
|
|
/// <param name="data">The byte array containing image data.</param>
|
|
|
|
/// <param name="data">The byte array containing encoded image data.</param>
|
|
|
|
/// <param name="decoder">The decoder.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
@ -171,5 +172,71 @@ namespace SixLabors.ImageSharp |
|
|
|
return Load<TPixel>(config, memoryStream, decoder); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte span.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte span containing image data.</param>
|
|
|
|
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
|
|
|
|
public static Image<Rgba32> Load(ReadOnlySpan<byte> data) => Load<Rgba32>(Configuration.Default, data); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte span.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The config for the decoder.</param>
|
|
|
|
/// <param name="data">The byte span containing encoded image data.</param>
|
|
|
|
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
|
|
|
|
public static Image<Rgba32> Load(Configuration config, ReadOnlySpan<byte> data) => Load<Rgba32>(config, data); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte span.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="data">The byte span containing encoded image data.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(ReadOnlySpan<byte> data) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
=> Load<TPixel>(Configuration.Default, data); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte span.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The configuration options.</param>
|
|
|
|
/// <param name="data">The byte span containing encoded image data.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(Configuration config, ReadOnlySpan<byte> data) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte span.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The Configuration.</param>
|
|
|
|
/// <param name="data">The byte span containing image data.</param>
|
|
|
|
/// <param name="decoder">The decoder.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(Configuration config, ReadOnlySpan<byte> data, IImageDecoder decoder) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load a new instance of <see cref="Image{TPixel}"/> from the given encoded byte span.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="config">The configuration options.</param>
|
|
|
|
/// <param name="data">The byte span containing image data.</param>
|
|
|
|
/// <param name="format">The <see cref="IImageFormat"/> of the decoded image.</param>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>
|
|
|
|
public static Image<TPixel> Load<TPixel>(Configuration config, ReadOnlySpan<byte> data, out IImageFormat format) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |