Browse Source

remove Image.Create

af/merge-core
Scott Williams 9 years ago
parent
commit
f01192c604
  1. 2
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  2. 2
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  3. 2
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
  4. 2
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  5. 52
      src/ImageSharp/Image/Image.Create.cs

2
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -127,7 +127,7 @@ namespace ImageSharp.Formats
+ $"bigger then the max allowed size '{Image<TPixel>.MaxWidth}x{Image<TPixel>.MaxHeight}'");
}
Image<TPixel> image = Image.Create<TPixel>(this.infoHeader.Width, this.infoHeader.Height, this.configuration);
Image<TPixel> image = new Image<TPixel>(this.infoHeader.Width, this.infoHeader.Height, this.configuration);
using (PixelAccessor<TPixel> pixels = image.Lock())
{
switch (this.infoHeader.Compression)

2
src/ImageSharp/Formats/Gif/GifDecoderCore.cs

@ -366,7 +366,7 @@ namespace ImageSharp.Formats
this.metaData.Quality = colorTableLength / 3;
// This initializes the image to become fully transparent because the alpha channel is zero.
this.image = Image.Create<TPixel>(imageWidth, imageHeight, this.metaData, this.configuration);
this.image = new Image<TPixel>(imageWidth, imageHeight, this.metaData, this.configuration);
this.SetFrameMetaData(this.metaData);

2
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -482,7 +482,7 @@ namespace ImageSharp.Formats
private Image<TPixel> ConvertJpegPixelsToImagePixels<TPixel>(ImageMetaData metadata)
where TPixel : struct, IPixel<TPixel>
{
Image<TPixel> image = Image.Create<TPixel>(this.ImageWidth, this.ImageHeight, metadata, this.configuration);
Image<TPixel> image = new Image<TPixel>(this.ImageWidth, this.ImageHeight, metadata, this.configuration);
if (this.grayImage.IsInitialized)
{

2
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -335,7 +335,7 @@ namespace ImageSharp.Formats
throw new ArgumentOutOfRangeException($"The input png '{this.header.Width}x{this.header.Height}' is bigger than the max allowed size '{Image<TPixel>.MaxWidth}x{Image<TPixel>.MaxHeight}'");
}
image = Image.Create<TPixel>(this.header.Width, this.header.Height, metadata, this.configuration);
image = new Image<TPixel>(this.header.Width, this.header.Height, metadata, this.configuration);
pixels = image.Lock();
this.bytesPerPixel = this.CalculateBytesPerPixel();
this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1;

52
src/ImageSharp/Image/Image.Create.cs

@ -1,52 +0,0 @@
// <copyright file="Image.Create.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp
{
using ImageSharp.PixelFormats;
/// <content>
/// Adds static methods allowing the creation of new images from given dimensions.
/// </content>
public static partial class Image
{
/// <summary>
/// Create a new instance of the <see cref="Image{TPixel}"/> class with the given height and the width.
/// </summary>
/// <param name="width">The width of the image in pixels.</param>
/// <param name="height">The height of the image in pixels.</param>
/// <param name="configuration">
/// The configuration providing initialization code which allows extending the library.
/// </param>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <returns>
/// A new <see cref="Image{TPixel}"/>.
/// </returns>
internal static Image<TPixel> Create<TPixel>(int width, int height, Configuration configuration)
where TPixel : struct, IPixel<TPixel>
{
return Create<TPixel>(width, height, null, configuration);
}
/// <summary>
/// Create a new instance of the <see cref="Image{TPixel}"/> class with the given height and the width.
/// </summary>
/// <param name="width">The width of the image in pixels.</param>
/// <param name="height">The height of the image in pixels.</param>
/// <param name="metadata">The images matadata to preload.</param>
/// <param name="configuration">
/// The configuration providing initialization code which allows extending the library.
/// </param>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <returns>
/// A new <see cref="Image{TPixel}"/>.
/// </returns>
internal static Image<TPixel> Create<TPixel>(int width, int height, ImageMetaData metadata, Configuration configuration)
where TPixel : struct, IPixel<TPixel>
{
return new Image<TPixel>(width, height, metadata, configuration);
}
}
}
Loading…
Cancel
Save