mirror of https://github.com/SixLabors/ImageSharp
committed by
GitHub
36 changed files with 863 additions and 274 deletions
@ -0,0 +1,21 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
|
|||
namespace SixLabors.ImageSharp.Formats |
|||
{ |
|||
/// <summary>
|
|||
/// Encapsulates methods used for detecting the raw image information without fully decoding it.
|
|||
/// </summary>
|
|||
public interface IImageInfoDetector |
|||
{ |
|||
/// <summary>
|
|||
/// Reads the raw image information from the specified stream.
|
|||
/// </summary>
|
|||
/// <param name="configuration">The configuration for the image.</param>
|
|||
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
|
|||
/// <returns>The <see cref="PixelTypeInfo"/> object</returns>
|
|||
IImageInfo Identify(Configuration configuration, Stream stream); |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats |
|||
{ |
|||
/// <summary>
|
|||
/// Contains information about the pixels that make up an images visual data.
|
|||
/// </summary>
|
|||
public class PixelTypeInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PixelTypeInfo"/> class.
|
|||
/// </summary>
|
|||
/// <param name="bitsPerPixel">Color depth, in number of bits per pixel.</param>
|
|||
internal PixelTypeInfo(int bitsPerPixel) |
|||
{ |
|||
this.BitsPerPixel = bitsPerPixel; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets color depth, in number of bits per pixel.
|
|||
/// </summary>
|
|||
public int BitsPerPixel { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Encapsulates the properties and methods that describe an image.
|
|||
/// </summary>
|
|||
public interface IImage : IImageInfo |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
using SixLabors.ImageSharp.MetaData; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Encapsulates properties that descibe basic image information including dimensions, pixel type information
|
|||
/// and additional metadata
|
|||
/// </summary>
|
|||
public interface IImageInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Gets information about the image pixels.
|
|||
/// </summary>
|
|||
PixelTypeInfo PixelType { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the width.
|
|||
/// </summary>
|
|||
int Width { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the height.
|
|||
/// </summary>
|
|||
int Height { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the metadata of the image.
|
|||
/// </summary>
|
|||
ImageMetaData MetaData { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
using SixLabors.ImageSharp.MetaData; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Contains information about the image including dimensions, pixel type information and additional metadata
|
|||
/// </summary>
|
|||
internal sealed class ImageInfo : IImageInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ImageInfo"/> class.
|
|||
/// </summary>
|
|||
/// <param name="pixelType">The 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) |
|||
{ |
|||
this.PixelType = pixelType; |
|||
this.Width = width; |
|||
this.Height = height; |
|||
this.MetaData = metaData; |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
public PixelTypeInfo PixelType { get; } |
|||
|
|||
/// <inheritdoc />
|
|||
public int Width { get; } |
|||
|
|||
/// <inheritdoc />
|
|||
public int Height { get; } |
|||
|
|||
/// <inheritdoc />
|
|||
public ImageMetaData MetaData { get; } |
|||
} |
|||
} |
|||
@ -1,120 +1,120 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<Description>A cross-platform library for the processing of image files; written in C#</Description> |
|||
<AssemblyTitle>SixLabors.ImageSharp</AssemblyTitle> |
|||
<VersionPrefix Condition="$(packageversion) != ''">$(packageversion)</VersionPrefix> |
|||
<VersionPrefix Condition="$(packageversion) == ''">0.0.1</VersionPrefix> |
|||
<Authors>Six Labors and contributors</Authors> |
|||
<TargetFrameworks>netstandard1.1;netstandard1.3;netstandard2.0</TargetFrameworks> |
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile> |
|||
<AssemblyName>SixLabors.ImageSharp</AssemblyName> |
|||
<PackageId>SixLabors.ImageSharp</PackageId> |
|||
<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> |
|||
<PackageProjectUrl>https://github.com/SixLabors/ImageSharp</PackageProjectUrl> |
|||
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl> |
|||
<RepositoryType>git</RepositoryType> |
|||
<RepositoryUrl>https://github.com/SixLabors/ImageSharp</RepositoryUrl> |
|||
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute> |
|||
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute> |
|||
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> |
|||
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> |
|||
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute> |
|||
<DebugType Condition="$(codecov) != ''">full</DebugType> |
|||
<DebugType Condition="$(codecov) == ''">portable</DebugType> |
|||
<DebugSymbols>True</DebugSymbols> |
|||
<Features>IOperation</Features> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Compile Include="..\Shared\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<PackageReference Include="SixLabors.Core" Version="1.0.0-beta0004" /> |
|||
<AdditionalFiles Include="..\..\stylecop.json" /> |
|||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004"> |
|||
<PrivateAssets>All</PrivateAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="System.Buffers" Version="4.4.0" /> |
|||
<PackageReference Include="System.Memory" Version="4.4.0-preview2-25405-01" /> |
|||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" /> |
|||
</ItemGroup> |
|||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' OR '$(TargetFramework)' == 'netstandard1.3'"> |
|||
<PackageReference Include="System.IO.Compression" Version="4.3.0" /> |
|||
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" /> |
|||
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" /> |
|||
<PackageReference Include="System.ValueTuple" Version="4.4.0" /> |
|||
</ItemGroup> |
|||
<PropertyGroup> |
|||
<CodeAnalysisRuleSet>..\..\ImageSharp.ruleset</CodeAnalysisRuleSet> |
|||
<RootNamespace>SixLabors.ImageSharp</RootNamespace> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<None Update="Formats\Jpeg\Common\Block8x8F.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>Block8x8F.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="Formats\Jpeg\Components\Block8x8F.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>Block8x8F.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>PixelOperations{TPixel}.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>Rgba32.PixelOperations.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.tt"> |
|||
<LastGenOutput>PorterDuffFunctions.Generated.cs</LastGenOutput> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
</None> |
|||
<None Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.tt"> |
|||
<LastGenOutput>DefaultPixelBlenders.Generated.cs</LastGenOutput> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
</None> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Update="Formats\Jpeg\Common\Block8x8F.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>Block8x8F.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="Formats\Jpeg\Components\Block8x8F.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>Block8x8F.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>PixelOperations{TPixel}.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>Rgba32.PixelOperations.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>DefaultPixelBlenders.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>PorterDuffFunctions.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
</ItemGroup> |
|||
<PropertyGroup> |
|||
<Description>A cross-platform library for the processing of image files; written in C#</Description> |
|||
<AssemblyTitle>SixLabors.ImageSharp</AssemblyTitle> |
|||
<VersionPrefix Condition="$(packageversion) != ''">$(packageversion)</VersionPrefix> |
|||
<VersionPrefix Condition="$(packageversion) == ''">0.0.1</VersionPrefix> |
|||
<Authors>Six Labors and contributors</Authors> |
|||
<TargetFrameworks>netstandard1.1;netstandard1.3;netstandard2.0</TargetFrameworks> |
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile> |
|||
<AssemblyName>SixLabors.ImageSharp</AssemblyName> |
|||
<PackageId>SixLabors.ImageSharp</PackageId> |
|||
<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> |
|||
<PackageProjectUrl>https://github.com/SixLabors/ImageSharp</PackageProjectUrl> |
|||
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl> |
|||
<RepositoryType>git</RepositoryType> |
|||
<RepositoryUrl>https://github.com/SixLabors/ImageSharp</RepositoryUrl> |
|||
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute> |
|||
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute> |
|||
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> |
|||
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> |
|||
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute> |
|||
<DebugType Condition="$(codecov) != ''">full</DebugType> |
|||
<DebugType Condition="$(codecov) == ''">portable</DebugType> |
|||
<DebugSymbols>True</DebugSymbols> |
|||
<Features>IOperation</Features> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Compile Include="..\Shared\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<PackageReference Include="SixLabors.Core" Version="1.0.0-beta0004" /> |
|||
<AdditionalFiles Include="..\..\stylecop.json" /> |
|||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004"> |
|||
<PrivateAssets>All</PrivateAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="System.Buffers" Version="4.4.0" /> |
|||
<PackageReference Include="System.Memory" Version="4.4.0-preview2-25405-01" /> |
|||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" /> |
|||
</ItemGroup> |
|||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' OR '$(TargetFramework)' == 'netstandard1.3'"> |
|||
<PackageReference Include="System.IO.Compression" Version="4.3.0" /> |
|||
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" /> |
|||
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" /> |
|||
<PackageReference Include="System.ValueTuple" Version="4.4.0" /> |
|||
</ItemGroup> |
|||
<PropertyGroup> |
|||
<CodeAnalysisRuleSet>..\..\ImageSharp.ruleset</CodeAnalysisRuleSet> |
|||
<RootNamespace>SixLabors.ImageSharp</RootNamespace> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<None Update="Formats\Jpeg\Common\Block8x8F.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>Block8x8F.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="Formats\Jpeg\Components\Block8x8F.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>Block8x8F.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>PixelOperations{TPixel}.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.tt"> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
<LastGenOutput>Rgba32.PixelOperations.Generated.cs</LastGenOutput> |
|||
</None> |
|||
<None Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.tt"> |
|||
<LastGenOutput>PorterDuffFunctions.Generated.cs</LastGenOutput> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
</None> |
|||
<None Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.tt"> |
|||
<LastGenOutput>DefaultPixelBlenders.Generated.cs</LastGenOutput> |
|||
<Generator>TextTemplatingFileGenerator</Generator> |
|||
</None> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Update="Formats\Jpeg\Common\Block8x8F.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>Block8x8F.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="Formats\Jpeg\Components\Block8x8F.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>Block8x8F.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\Generated\PixelOperations{TPixel}.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>PixelOperations{TPixel}.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\Generated\Rgba32.PixelOperations.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>Rgba32.PixelOperations.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\PixelBlenders\DefaultPixelBlenders.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>DefaultPixelBlenders.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
<Compile Update="PixelFormats\PixelBlenders\PorterDuffFunctions.Generated.cs"> |
|||
<DesignTime>True</DesignTime> |
|||
<AutoGen>True</AutoGen> |
|||
<DependentUpon>PorterDuffFunctions.Generated.tt</DependentUpon> |
|||
</Compile> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,3 @@ |
|||
version https://git-lfs.github.com/spec/v1 |
|||
oid sha256:364e9fac6467570afe2f23e432d4f7df10dd2dd53920d4f2c743ac0f8519f1e0 |
|||
size 4403 |
|||
@ -0,0 +1,3 @@ |
|||
version https://git-lfs.github.com/spec/v1 |
|||
oid sha256:e7c6d6cbd959e84001e559702c31e313d065c9cc25808c190c4d4a1f564d4357 |
|||
size 7396 |
|||
@ -0,0 +1,3 @@ |
|||
version https://git-lfs.github.com/spec/v1 |
|||
oid sha256:7bfbc244f4b0672d6a12a1f73ec062bcf762f229268b99aa4b9ffd8447512471 |
|||
size 9171 |
|||
Loading…
Reference in new issue