mirror of https://github.com/SixLabors/ImageSharp
33 changed files with 282 additions and 188 deletions
@ -1,6 +1,7 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<RuleSet Name="ImageSharp" ToolsVersion="14.0"> |
<RuleSet Name="ImageSharp" ToolsVersion="14.0"> |
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> |
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> |
||||
|
<Rule Id="SA1405" Action="None" /> |
||||
<Rule Id="SA1413" Action="None" /> |
<Rule Id="SA1413" Action="None" /> |
||||
</Rules> |
</Rules> |
||||
</RuleSet> |
</RuleSet> |
||||
|
|||||
@ -0,0 +1,25 @@ |
|||||
|
// <copyright file="IImage.cs" company="James Jackson-South">
|
||||
|
// Copyright (c) James Jackson-South and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
// </copyright>
|
||||
|
|
||||
|
namespace ImageSharp |
||||
|
{ |
||||
|
using Formats; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Encapsulates the basic properties and methods required to manipulate images.
|
||||
|
/// </summary>
|
||||
|
internal interface IImage : IImageBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets the currently loaded image format.
|
||||
|
/// </summary>
|
||||
|
IImageFormat CurrentImageFormat { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the meta data of the image.
|
||||
|
/// </summary>
|
||||
|
ImageMetaData MetaData { get; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,130 @@ |
|||||
|
// <copyright file="ImageMetaData.cs" company="James Jackson-South">
|
||||
|
// Copyright (c) James Jackson-South and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
// </copyright>
|
||||
|
|
||||
|
namespace ImageSharp |
||||
|
{ |
||||
|
using System.Collections.Generic; |
||||
|
using System.Diagnostics; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Encapsulates the metadata of an image.
|
||||
|
/// </summary>
|
||||
|
public sealed class ImageMetaData |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The default horizontal resolution value (dots per inch) in x direction.
|
||||
|
/// <remarks>The default value is 96 dots per inch.</remarks>
|
||||
|
/// </summary>
|
||||
|
public const double DefaultHorizontalResolution = 96; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The default vertical resolution value (dots per inch) in y direction.
|
||||
|
/// <remarks>The default value is 96 dots per inch.</remarks>
|
||||
|
/// </summary>
|
||||
|
public const double DefaultVerticalResolution = 96; |
||||
|
|
||||
|
private double horizontalResolution; |
||||
|
private double verticalResolution; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Initializes a new instance of the <see cref="ImageMetaData"/> class.
|
||||
|
/// </summary>
|
||||
|
internal ImageMetaData() |
||||
|
{ |
||||
|
this.horizontalResolution = DefaultHorizontalResolution; |
||||
|
this.verticalResolution = DefaultVerticalResolution; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Initializes a new instance of the <see cref="ImageMetaData"/> class
|
||||
|
/// by making a copy from other metadata.
|
||||
|
/// </summary>
|
||||
|
/// <param name="other">
|
||||
|
/// The other <see cref="ImageMetaData"/> to create this instance from.
|
||||
|
/// </param>
|
||||
|
internal ImageMetaData(ImageMetaData other) |
||||
|
{ |
||||
|
Debug.Assert(other != null); |
||||
|
|
||||
|
this.HorizontalResolution = other.HorizontalResolution; |
||||
|
this.VerticalResolution = other.VerticalResolution; |
||||
|
this.Quality = other.Quality; |
||||
|
|
||||
|
foreach (ImageProperty property in other.Properties) |
||||
|
{ |
||||
|
this.Properties.Add(new ImageProperty(property)); |
||||
|
} |
||||
|
|
||||
|
if (other.ExifProfile != null) |
||||
|
{ |
||||
|
this.ExifProfile = new ExifProfile(other.ExifProfile); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets or sets the resolution of the image in x- direction. It is defined as
|
||||
|
/// number of dots per inch and should be an positive value.
|
||||
|
/// </summary>
|
||||
|
/// <value>The density of the image in x- direction.</value>
|
||||
|
public double HorizontalResolution |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return this.horizontalResolution; |
||||
|
} |
||||
|
|
||||
|
set |
||||
|
{ |
||||
|
if (value >= 0) |
||||
|
{ |
||||
|
this.horizontalResolution = value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets or sets the resolution of the image in y- direction. It is defined as
|
||||
|
/// number of dots per inch and should be an positive value.
|
||||
|
/// </summary>
|
||||
|
/// <value>The density of the image in y- direction.</value>
|
||||
|
public double VerticalResolution |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return this.verticalResolution; |
||||
|
} |
||||
|
|
||||
|
set |
||||
|
{ |
||||
|
if (value >= 0) |
||||
|
{ |
||||
|
this.verticalResolution = value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets or sets the Exif profile.
|
||||
|
/// </summary>
|
||||
|
public ExifProfile ExifProfile { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the list of properties for storing meta information about this image.
|
||||
|
/// </summary>
|
||||
|
/// <value>A list of image properties.</value>
|
||||
|
public IList<ImageProperty> Properties { get; } = new List<ImageProperty>(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets or sets the quality of the image. This affects the output quality of lossy image formats.
|
||||
|
/// </summary>
|
||||
|
public int Quality { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets or sets the number of times any animation is repeated.
|
||||
|
/// <remarks>0 means to repeat indefinitely.</remarks>
|
||||
|
/// </summary>
|
||||
|
public ushort RepeatCount { get; set; } |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue