Browse Source

changes on code review

af/merge-core
denisivan0v 8 years ago
parent
commit
abaa167999
  1. 2
      src/ImageSharp/Formats/Bmp/BmpDecoder.cs
  2. 4
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  3. 2
      src/ImageSharp/Formats/Gif/GifDecoder.cs
  4. 6
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  5. 6
      src/ImageSharp/Formats/IImageInfoDetector.cs
  6. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoder.cs
  7. 6
      src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
  8. 2
      src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
  9. 2
      src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
  10. 2
      src/ImageSharp/Formats/PixelTypeInfo.cs
  11. 2
      src/ImageSharp/Formats/Png/PngDecoder.cs
  12. 6
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  13. 26
      src/ImageSharp/Image/IImage.cs
  14. 31
      src/ImageSharp/Image/IImageInfo.cs
  15. 4
      src/ImageSharp/Image/Image.Decode.cs
  16. 12
      src/ImageSharp/Image/Image.FromStream.cs
  17. 4
      src/ImageSharp/Image/ImageFrameCollection.cs
  18. 16
      src/ImageSharp/Image/ImageInfo.cs
  19. 18
      src/ImageSharp/Image/Image{TPixel}.cs
  20. 236
      src/ImageSharp/ImageSharp.csproj
  21. 2
      src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
  22. 5
      tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs

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

@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
} }
/// <inheritdoc/> /// <inheritdoc/>
public IImage Identify(Configuration configuration, Stream stream) public IImageInfo Identify(Configuration configuration, Stream stream)
{ {
Guard.NotNull(stream, "stream"); Guard.NotNull(stream, "stream");

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

@ -141,10 +141,10 @@ namespace SixLabors.ImageSharp.Formats.Bmp
} }
/// <summary> /// <summary>
/// Reads the image base information from the specified stream. /// Reads the raw image information from the specified stream.
/// </summary> /// </summary>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param> /// <param name="stream">The <see cref="Stream"/> containing image data.</param>
public IImage Identify(Stream stream) public IImageInfo Identify(Stream stream)
{ {
this.ReadImageHeaders(stream, out _, out _); this.ReadImageHeaders(stream, out _, out _);
return new ImageInfo(new PixelTypeInfo(this.infoHeader.BitsPerPixel), this.infoHeader.Width, this.infoHeader.Height, new ImageMetaData()); return new ImageInfo(new PixelTypeInfo(this.infoHeader.BitsPerPixel), this.infoHeader.Width, this.infoHeader.Height, new ImageMetaData());

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

@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
} }
/// <inheritdoc/> /// <inheritdoc/>
public IImage Identify(Configuration configuration, Stream stream) public IImageInfo Identify(Configuration configuration, Stream stream)
{ {
Guard.NotNull(stream, "stream"); Guard.NotNull(stream, "stream");

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

@ -165,10 +165,10 @@ namespace SixLabors.ImageSharp.Formats.Gif
} }
/// <summary> /// <summary>
/// Reads the image base information from the specified stream. /// Reads the raw image information from the specified stream.
/// </summary> /// </summary>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param> /// <param name="stream">The <see cref="Stream"/> containing image data.</param>
public IImage Identify(Stream stream) public IImageInfo Identify(Stream stream)
{ {
try try
{ {
@ -425,7 +425,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
if (previousFrame == null) if (previousFrame == null)
{ {
// This initializes the image to become fully transparent because the alpha channel is zero. // This initializes the image to become fully transparent because the alpha channel is zero.
image = new Image<TPixel>(this.configuration, new PixelTypeInfo(this.logicalScreenDescriptor.BitsPerPixel), imageWidth, imageHeight, this.metaData); image = new Image<TPixel>(this.configuration, imageWidth, imageHeight, this.metaData);
this.SetFrameMetaData(image.Frames.RootFrame.MetaData); this.SetFrameMetaData(image.Frames.RootFrame.MetaData);

6
src/ImageSharp/Formats/IImageInfoDetector.cs

@ -6,16 +6,16 @@ using System.IO;
namespace SixLabors.ImageSharp.Formats namespace SixLabors.ImageSharp.Formats
{ {
/// <summary> /// <summary>
/// Used for detecting the image base information without decoding it. /// Used for detecting the raw image information without decoding it.
/// </summary> /// </summary>
public interface IImageInfoDetector public interface IImageInfoDetector
{ {
/// <summary> /// <summary>
/// Reads the image base information from the specified stream. /// Reads the raw image information from the specified stream.
/// </summary> /// </summary>
/// <param name="configuration">The configuration for the image.</param> /// <param name="configuration">The configuration for the image.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param> /// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <returns>The <see cref="PixelTypeInfo"/> object</returns> /// <returns>The <see cref="PixelTypeInfo"/> object</returns>
IImage Identify(Configuration configuration, Stream stream); IImageInfo Identify(Configuration configuration, Stream stream);
} }
} }

2
src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoder.cs

@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
} }
/// <inheritdoc/> /// <inheritdoc/>
public IImage Identify(Configuration configuration, Stream stream) public IImageInfo Identify(Configuration configuration, Stream stream)
{ {
Guard.NotNull(stream, "stream"); Guard.NotNull(stream, "stream");

6
src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs

@ -198,10 +198,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
} }
/// <summary> /// <summary>
/// Reads the image base information from the specified stream. /// Reads the raw image information from the specified stream.
/// </summary> /// </summary>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param> /// <param name="stream">The <see cref="Stream"/> containing image data.</param>
public IImage Identify(Stream stream) public IImageInfo Identify(Stream stream)
{ {
this.ParseStream(stream, true); this.ParseStream(stream, true);
return new ImageInfo(new PixelTypeInfo(this.BitsPerPixel), this.ImageWidth, this.ImageHeight, this.MetaData); return new ImageInfo(new PixelTypeInfo(this.BitsPerPixel), this.ImageWidth, this.ImageHeight, this.MetaData);
@ -789,7 +789,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
{ {
using (var postProcessor = new JpegImagePostProcessor(this)) using (var postProcessor = new JpegImagePostProcessor(this))
{ {
var image = new Image<TPixel>(this.configuration, new PixelTypeInfo(this.BitsPerPixel), this.ImageWidth, this.ImageHeight, this.MetaData); var image = new Image<TPixel>(this.configuration, this.ImageWidth, this.ImageHeight, this.MetaData);
postProcessor.PostProcess(image.Frames.RootFrame); postProcessor.PostProcess(image.Frames.RootFrame);
return image; return image;
} }

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

@ -31,7 +31,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
} }
/// <inheritdoc/> /// <inheritdoc/>
public IImage Identify(Configuration configuration, Stream stream) public IImageInfo Identify(Configuration configuration, Stream stream)
{ {
Guard.NotNull(stream, "stream"); Guard.NotNull(stream, "stream");

2
src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs

@ -159,7 +159,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
this.QuantizeAndInverseAllComponents(); this.QuantizeAndInverseAllComponents();
var image = new Image<TPixel>(this.configuration, null, this.ImageWidth, this.ImageHeight, metadata); var image = new Image<TPixel>(this.configuration, this.ImageWidth, this.ImageHeight, metadata);
this.FillPixelData(image.Frames.RootFrame); this.FillPixelData(image.Frames.RootFrame);
this.AssignResolution(image); this.AssignResolution(image);
return image; return image;

2
src/ImageSharp/Formats/PixelTypeInfo.cs

@ -1,7 +1,7 @@
namespace SixLabors.ImageSharp.Formats namespace SixLabors.ImageSharp.Formats
{ {
/// <summary> /// <summary>
/// Stores information about pixel. /// Stores the raw image pixel type information.
/// </summary> /// </summary>
public class PixelTypeInfo public class PixelTypeInfo
{ {

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

@ -54,7 +54,7 @@ namespace SixLabors.ImageSharp.Formats.Png
} }
/// <inheritdoc/> /// <inheritdoc/>
public IImage Identify(Configuration configuration, Stream stream) public IImageInfo Identify(Configuration configuration, Stream stream)
{ {
var decoder = new PngDecoderCore(configuration, this); var decoder = new PngDecoderCore(configuration, this);
return decoder.Identify(stream); return decoder.Identify(stream);

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

@ -279,10 +279,10 @@ namespace SixLabors.ImageSharp.Formats.Png
} }
/// <summary> /// <summary>
/// Reads the image base information from the specified stream. /// Reads the raw image information from the specified stream.
/// </summary> /// </summary>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param> /// <param name="stream">The <see cref="Stream"/> containing image data.</param>
public IImage Identify(Stream stream) public IImageInfo Identify(Stream stream)
{ {
var metadata = new ImageMetaData(); var metadata = new ImageMetaData();
this.currentStream = stream; this.currentStream = stream;
@ -426,7 +426,7 @@ namespace SixLabors.ImageSharp.Formats.Png
private void InitializeImage<TPixel>(ImageMetaData metadata, out Image<TPixel> image) private void InitializeImage<TPixel>(ImageMetaData metadata, out Image<TPixel> image)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
image = new Image<TPixel>(this.configuration, new PixelTypeInfo(this.CalculateBitsPerPixel()), this.header.Width, this.header.Height, metadata); image = new Image<TPixel>(this.configuration, this.header.Width, this.header.Height, metadata);
this.bytesPerPixel = this.CalculateBytesPerPixel(); this.bytesPerPixel = this.CalculateBytesPerPixel();
this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1; this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1;
this.bytesPerSample = 1; this.bytesPerSample = 1;

26
src/ImageSharp/Image/IImage.cs

@ -1,31 +1,9 @@
using SixLabors.ImageSharp.Formats; namespace SixLabors.ImageSharp
using SixLabors.ImageSharp.MetaData;
namespace SixLabors.ImageSharp
{ {
/// <summary> /// <summary>
/// Represents the base image abstraction. /// Represents the base image abstraction.
/// </summary> /// </summary>
public interface IImage public interface IImage : IImageInfo
{ {
/// <summary>
/// Gets information about pixel.
/// </summary>
PixelTypeInfo PixelType { get; }
/// <summary>
/// Gets the width.
/// </summary>
int Width { get; }
/// <summary>
/// Gets the height.
/// </summary>
int Height { get; }
/// <summary>
/// Gets the meta data of the image.
/// </summary>
ImageMetaData MetaData { get; }
} }
} }

31
src/ImageSharp/Image/IImageInfo.cs

@ -0,0 +1,31 @@
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.MetaData;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Represents raw image information.
/// </summary>
public interface IImageInfo
{
/// <summary>
/// Gets the raw image pixel type information.
/// </summary>
PixelTypeInfo PixelType { get; }
/// <summary>
/// Gets the width.
/// </summary>
int Width { get; }
/// <summary>
/// Gets the height.
/// </summary>
int Height { get; }
/// <summary>
/// Gets the meta data of the image.
/// </summary>
ImageMetaData MetaData { get; }
}
}

4
src/ImageSharp/Image/Image.Decode.cs

@ -86,9 +86,9 @@ namespace SixLabors.ImageSharp
/// <param name="stream">The stream.</param> /// <param name="stream">The stream.</param>
/// <param name="config">the configuration.</param> /// <param name="config">the configuration.</param>
/// <returns> /// <returns>
/// The <see cref="IImage"/> or null if suitable info detector not found. /// The <see cref="IImageInfo"/> or null if suitable info detector not found.
/// </returns> /// </returns>
private static IImage InternalIdentity(Stream stream, Configuration config) private static IImageInfo InternalIdentity(Stream stream, Configuration config)
{ {
var detector = DiscoverDecoder(stream, config, out IImageFormat _) as IImageInfoDetector; var detector = DiscoverDecoder(stream, config, out IImageFormat _) as IImageInfoDetector;
return detector?.Identify(config, stream); return detector?.Identify(config, stream);

12
src/ImageSharp/Image/Image.FromStream.cs

@ -37,22 +37,22 @@ namespace SixLabors.ImageSharp
} }
/// <summary> /// <summary>
/// By reading the header on the provided stream this reads the image base information. /// By reading the header on the provided stream this reads the raw image information.
/// </summary> /// </summary>
/// <param name="stream">The image stream to read the header from.</param> /// <param name="stream">The image stream to read the header from.</param>
/// <exception cref="NotSupportedException"> /// <exception cref="NotSupportedException">
/// Thrown if the stream is not readable nor seekable. /// Thrown if the stream is not readable nor seekable.
/// </exception> /// </exception>
/// <returns> /// <returns>
/// The <see cref="IImage"/> or null if suitable info detector not found. /// The <see cref="IImageInfo"/> or null if suitable info detector not found.
/// </returns> /// </returns>
public static IImage Identify(Stream stream) public static IImageInfo Identify(Stream stream)
{ {
return Identify(null, stream); return Identify(null, stream);
} }
/// <summary> /// <summary>
/// By reading the header on the provided stream this reads the image base information. /// By reading the header on the provided stream this reads the raw image information.
/// </summary> /// </summary>
/// <param name="config">The configuration.</param> /// <param name="config">The configuration.</param>
/// <param name="stream">The image stream to read the header from.</param> /// <param name="stream">The image stream to read the header from.</param>
@ -60,9 +60,9 @@ namespace SixLabors.ImageSharp
/// Thrown if the stream is not readable nor seekable. /// Thrown if the stream is not readable nor seekable.
/// </exception> /// </exception>
/// <returns> /// <returns>
/// The <see cref="IImage"/> or null if suitable info detector not found. /// The <see cref="IImageInfo"/> or null if suitable info detector not found.
/// </returns> /// </returns>
public static IImage Identify(Configuration config, Stream stream) public static IImageInfo Identify(Configuration config, Stream stream)
{ {
return WithSeekableStream(stream, s => InternalIdentity(s, config ?? Configuration.Default)); return WithSeekableStream(stream, s => InternalIdentity(s, config ?? Configuration.Default));
} }

4
src/ImageSharp/Image/ImageFrameCollection.cs

@ -129,7 +129,7 @@ namespace SixLabors.ImageSharp
this.frames.Remove(frame); this.frames.Remove(frame);
return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.PixelType, this.parent.MetaData.Clone(), new[] { frame }); return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.Clone(), new[] { frame });
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -137,7 +137,7 @@ namespace SixLabors.ImageSharp
{ {
ImageFrame<TPixel> frame = this[index]; ImageFrame<TPixel> frame = this[index];
ImageFrame<TPixel> clonedFrame = frame.Clone(); ImageFrame<TPixel> clonedFrame = frame.Clone();
return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.PixelType, this.parent.MetaData.Clone(), new[] { clonedFrame }); return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.Clone(), new[] { clonedFrame });
} }
/// <inheritdoc/> /// <inheritdoc/>

16
src/ImageSharp/Image/ImageInfo.cs

@ -3,8 +3,18 @@ using SixLabors.ImageSharp.MetaData;
namespace SixLabors.ImageSharp namespace SixLabors.ImageSharp
{ {
internal sealed class ImageInfo : IImage /// <summary>
/// Stores the raw image information.
/// </summary>
internal sealed class ImageInfo : IImageInfo
{ {
/// <summary>
/// Initializes a new instance of the <see cref="ImageInfo"/> class.
/// </summary>
/// <param name="pixelType">The raw image pixel type information.</param>
/// <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 metadata.</param>
public ImageInfo(PixelTypeInfo pixelType, int width, int height, ImageMetaData metaData) public ImageInfo(PixelTypeInfo pixelType, int width, int height, ImageMetaData metaData)
{ {
this.PixelType = pixelType; this.PixelType = pixelType;
@ -13,12 +23,16 @@ namespace SixLabors.ImageSharp
this.MetaData = metaData; this.MetaData = metaData;
} }
/// <inheritdoc />
public PixelTypeInfo PixelType { get; } public PixelTypeInfo PixelType { get; }
/// <inheritdoc />
public int Width { get; } public int Width { get; }
/// <inheritdoc />
public int Height { get; } public int Height { get; }
/// <inheritdoc />
public ImageMetaData MetaData { get; } public ImageMetaData MetaData { get; }
} }
} }

18
src/ImageSharp/Image/Image{TPixel}.cs

@ -5,9 +5,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp
/// <param name="width">The width of the image in pixels.</param> /// <param name="width">The width of the image in pixels.</param>
/// <param name="height">The height of the image in pixels.</param> /// <param name="height">The height of the image in pixels.</param>
public Image(Configuration configuration, int width, int height) public Image(Configuration configuration, int width, int height)
: this(configuration, null, width, height, new ImageMetaData()) : this(configuration, width, height, new ImageMetaData())
{ {
} }
@ -55,14 +55,13 @@ namespace SixLabors.ImageSharp
/// <param name="configuration"> /// <param name="configuration">
/// The configuration providing initialization code which allows extending the library. /// The configuration providing initialization code which allows extending the library.
/// </param> /// </param>
/// <param name="pixelType">The information about pixel of the image.</param>
/// <param name="width">The width of the image in pixels.</param> /// <param name="width">The width of the image in pixels.</param>
/// <param name="height">The height of the image in pixels.</param> /// <param name="height">The height of the image in pixels.</param>
/// <param name="metadata">The images metadata.</param> /// <param name="metadata">The images metadata.</param>
internal Image(Configuration configuration, PixelTypeInfo pixelType, int width, int height, ImageMetaData metadata) internal Image(Configuration configuration, int width, int height, ImageMetaData metadata)
{ {
this.configuration = configuration ?? Configuration.Default; this.configuration = configuration ?? Configuration.Default;
this.PixelType = pixelType; this.PixelType = new PixelTypeInfo(Unsafe.SizeOf<TPixel>() * 8);
this.MetaData = metadata ?? new ImageMetaData(); this.MetaData = metadata ?? new ImageMetaData();
this.frames = new ImageFrameCollection<TPixel>(this, width, height); this.frames = new ImageFrameCollection<TPixel>(this, width, height);
} }
@ -72,13 +71,12 @@ namespace SixLabors.ImageSharp
/// with the height and the width of the image. /// with the height and the width of the image.
/// </summary> /// </summary>
/// <param name="configuration">The configuration providing initialization code which allows extending the library.</param> /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
/// <param name="pixelType">The information about pixel of the image.</param>
/// <param name="metadata">The images metadata.</param> /// <param name="metadata">The images metadata.</param>
/// <param name="frames">The frames that will be owned by this image instance.</param> /// <param name="frames">The frames that will be owned by this image instance.</param>
internal Image(Configuration configuration, PixelTypeInfo pixelType, ImageMetaData metadata, IEnumerable<ImageFrame<TPixel>> frames) internal Image(Configuration configuration, ImageMetaData metadata, IEnumerable<ImageFrame<TPixel>> frames)
{ {
this.configuration = configuration ?? Configuration.Default; this.configuration = configuration ?? Configuration.Default;
this.PixelType = pixelType; this.PixelType = new PixelTypeInfo(Unsafe.SizeOf<TPixel>() * 8);
this.MetaData = metadata ?? new ImageMetaData(); this.MetaData = metadata ?? new ImageMetaData();
this.frames = new ImageFrameCollection<TPixel>(this, frames); this.frames = new ImageFrameCollection<TPixel>(this, frames);
@ -145,7 +143,7 @@ namespace SixLabors.ImageSharp
public Image<TPixel> Clone() public Image<TPixel> Clone()
{ {
IEnumerable<ImageFrame<TPixel>> clonedFrames = this.frames.Select(x => x.Clone()); IEnumerable<ImageFrame<TPixel>> clonedFrames = this.frames.Select(x => x.Clone());
return new Image<TPixel>(this.configuration, this.PixelType, this.MetaData.Clone(), clonedFrames); return new Image<TPixel>(this.configuration, this.MetaData.Clone(), clonedFrames);
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -163,7 +161,7 @@ namespace SixLabors.ImageSharp
where TPixel2 : struct, IPixel<TPixel2> where TPixel2 : struct, IPixel<TPixel2>
{ {
IEnumerable<ImageFrame<TPixel2>> clonedFrames = this.frames.Select(x => x.CloneAs<TPixel2>()); IEnumerable<ImageFrame<TPixel2>> clonedFrames = this.frames.Select(x => x.CloneAs<TPixel2>());
var target = new Image<TPixel2>(this.configuration, this.PixelType, this.MetaData.Clone(), clonedFrames); var target = new Image<TPixel2>(this.configuration, this.MetaData.Clone(), clonedFrames);
return target; return target;
} }

236
src/ImageSharp/ImageSharp.csproj

@ -1,120 +1,120 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Description>A cross-platform library for the processing of image files; written in C#</Description> <Description>A cross-platform library for the processing of image files; written in C#</Description>
<AssemblyTitle>SixLabors.ImageSharp</AssemblyTitle> <AssemblyTitle>SixLabors.ImageSharp</AssemblyTitle>
<VersionPrefix Condition="$(packageversion) != ''">$(packageversion)</VersionPrefix> <VersionPrefix Condition="$(packageversion) != ''">$(packageversion)</VersionPrefix>
<VersionPrefix Condition="$(packageversion) == ''">0.0.1</VersionPrefix> <VersionPrefix Condition="$(packageversion) == ''">0.0.1</VersionPrefix>
<Authors>Six Labors and contributors</Authors> <Authors>Six Labors and contributors</Authors>
<TargetFrameworks>netstandard1.1;netstandard1.3;netstandard2.0</TargetFrameworks> <TargetFrameworks>netstandard1.1;netstandard1.3;netstandard2.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>SixLabors.ImageSharp</AssemblyName> <AssemblyName>SixLabors.ImageSharp</AssemblyName>
<PackageId>SixLabors.ImageSharp</PackageId> <PackageId>SixLabors.ImageSharp</PackageId>
<PackageTags>Image Resize Crop Gif Jpg Jpeg Bitmap Png Core</PackageTags> <PackageTags>Image Resize Crop Gif Jpg Jpeg Bitmap Png Core</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/SixLabors/ImageSharp/master/build/icons/imagesharp-logo-128.png</PackageIconUrl> <PackageIconUrl>https://raw.githubusercontent.com/SixLabors/ImageSharp/master/build/icons/imagesharp-logo-128.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/SixLabors/ImageSharp</PackageProjectUrl> <PackageProjectUrl>https://github.com/SixLabors/ImageSharp</PackageProjectUrl>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl> <PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/SixLabors/ImageSharp</RepositoryUrl> <RepositoryUrl>https://github.com/SixLabors/ImageSharp</RepositoryUrl>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute> <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute> <GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute> <GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<DebugType Condition="$(codecov) != ''">full</DebugType> <DebugType Condition="$(codecov) != ''">full</DebugType>
<DebugType Condition="$(codecov) == ''">portable</DebugType> <DebugType Condition="$(codecov) == ''">portable</DebugType>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<Features>IOperation</Features> <Features>IOperation</Features>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\Shared\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" /> <Compile Include="..\Shared\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SixLabors.Core" Version="1.0.0-beta0004" /> <PackageReference Include="SixLabors.Core" Version="1.0.0-beta0004" />
<AdditionalFiles Include="..\..\stylecop.json" /> <AdditionalFiles Include="..\..\stylecop.json" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004"> <PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004">
<PrivateAssets>All</PrivateAssets> <PrivateAssets>All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.Buffers" Version="4.4.0" /> <PackageReference Include="System.Buffers" Version="4.4.0" />
<PackageReference Include="System.Memory" Version="4.4.0-preview2-25405-01" /> <PackageReference Include="System.Memory" Version="4.4.0-preview2-25405-01" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' OR '$(TargetFramework)' == 'netstandard1.3'"> <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' OR '$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.IO.Compression" Version="4.3.0" /> <PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.4.0" />
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" /> <PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" /> <PackageReference Include="System.ValueTuple" Version="4.4.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<CodeAnalysisRuleSet>..\..\ImageSharp.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>..\..\ImageSharp.ruleset</CodeAnalysisRuleSet>
<RootNamespace>SixLabors.ImageSharp</RootNamespace> <RootNamespace>SixLabors.ImageSharp</RootNamespace>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Update="Formats\Jpeg\Common\Block8x8F.Generated.tt"> <None Update="Formats\Jpeg\Common\Block8x8F.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Block8x8F.Generated.cs</LastGenOutput> <LastGenOutput>Block8x8F.Generated.cs</LastGenOutput>
</None> </None>
<None Update="Formats\Jpeg\Components\Block8x8F.Generated.tt"> <None Update="Formats\Jpeg\Components\Block8x8F.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Block8x8F.Generated.cs</LastGenOutput> <LastGenOutput>Block8x8F.Generated.cs</LastGenOutput>
</None> </None>
<None Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.tt"> <None Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>PixelOperations{TPixel}.Generated.cs</LastGenOutput> <LastGenOutput>PixelOperations{TPixel}.Generated.cs</LastGenOutput>
</None> </None>
<None Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.tt"> <None Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Rgba32.PixelOperations.Generated.cs</LastGenOutput> <LastGenOutput>Rgba32.PixelOperations.Generated.cs</LastGenOutput>
</None> </None>
<None Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.tt"> <None Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.tt">
<LastGenOutput>PorterDuffFunctions.Generated.cs</LastGenOutput> <LastGenOutput>PorterDuffFunctions.Generated.cs</LastGenOutput>
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
</None> </None>
<None Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.tt"> <None Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.tt">
<LastGenOutput>DefaultPixelBlenders.Generated.cs</LastGenOutput> <LastGenOutput>DefaultPixelBlenders.Generated.cs</LastGenOutput>
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Formats\Jpeg\Common\Block8x8F.Generated.cs"> <Compile Update="Formats\Jpeg\Common\Block8x8F.Generated.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Block8x8F.Generated.tt</DependentUpon> <DependentUpon>Block8x8F.Generated.tt</DependentUpon>
</Compile> </Compile>
<Compile Update="Formats\Jpeg\Components\Block8x8F.Generated.cs"> <Compile Update="Formats\Jpeg\Components\Block8x8F.Generated.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Block8x8F.Generated.tt</DependentUpon> <DependentUpon>Block8x8F.Generated.tt</DependentUpon>
</Compile> </Compile>
<Compile Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.cs"> <Compile Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>PixelOperations{TPixel}.Generated.tt</DependentUpon> <DependentUpon>PixelOperations{TPixel}.Generated.tt</DependentUpon>
</Compile> </Compile>
<Compile Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.cs"> <Compile Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Rgba32.PixelOperations.Generated.tt</DependentUpon> <DependentUpon>Rgba32.PixelOperations.Generated.tt</DependentUpon>
</Compile> </Compile>
<Compile Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.cs"> <Compile Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>DefaultPixelBlenders.Generated.tt</DependentUpon> <DependentUpon>DefaultPixelBlenders.Generated.tt</DependentUpon>
</Compile> </Compile>
<Compile Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.cs"> <Compile Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>PorterDuffFunctions.Generated.tt</DependentUpon> <DependentUpon>PorterDuffFunctions.Generated.tt</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
</Project> </Project>

2
src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs

@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
// For resize we know we are going to populate every pixel with fresh data and we want a different target size so // For resize we know we are going to populate every pixel with fresh data and we want a different target size so
// let's manually clone an empty set of images at the correct target and then have the base class process them in turn. // let's manually clone an empty set of images at the correct target and then have the base class process them in turn.
IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(this.Width, this.Height, x.MetaData.Clone())); // this will create places holders IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(this.Width, this.Height, x.MetaData.Clone())); // this will create places holders
var image = new Image<TPixel>(config, source.PixelType, source.MetaData.Clone(), frames); // base the place holder images in to prevent a extra frame being added var image = new Image<TPixel>(config, source.MetaData.Clone(), frames); // base the place holder images in to prevent a extra frame being added
return image; return image;
} }

5
tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs

@ -5,12 +5,11 @@
using System.IO; using System.IO;
using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
{ {
using SixLabors.ImageSharp.MetaData;
public class SystemDrawingReferenceDecoder : IImageDecoder, IImageInfoDetector public class SystemDrawingReferenceDecoder : IImageDecoder, IImageInfoDetector
{ {
public static SystemDrawingReferenceDecoder Instance { get; } = new SystemDrawingReferenceDecoder(); public static SystemDrawingReferenceDecoder Instance { get; } = new SystemDrawingReferenceDecoder();
@ -44,7 +43,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
} }
} }
public IImage Identify(Configuration configuration, Stream stream) public IImageInfo Identify(Configuration configuration, Stream stream)
{ {
using (var sourceBitmap = new System.Drawing.Bitmap(stream)) using (var sourceBitmap = new System.Drawing.Bitmap(stream))
{ {

Loading…
Cancel
Save