mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
4.4 KiB
109 lines
4.4 KiB
// <copyright file="IImageBase.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageProcessorCore
|
|
{
|
|
/// <summary>
|
|
/// Encapsulates the basic properties and methods required to manipulate images in varying formats.
|
|
/// </summary>
|
|
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
|
|
public interface IImageBase<TColor, TPacked> : IImageBase
|
|
where TColor : struct, IPackedVector<TPacked>
|
|
where TPacked : struct
|
|
{
|
|
/// <summary>
|
|
/// Gets the pixels as an array of the given packed pixel format.
|
|
/// </summary>
|
|
TColor[] Pixels { get; }
|
|
|
|
/// <summary>
|
|
/// Sets the pixel array of the image to the given value.
|
|
/// </summary>
|
|
/// <param name="width">The new width of the image. Must be greater than zero.</param>
|
|
/// <param name="height">The new height of the image. Must be greater than zero.</param>
|
|
/// <param name="pixels">The array with pixels. Must be a multiple of the width and height.</param>
|
|
/// <exception cref="System.ArgumentOutOfRangeException">
|
|
/// Thrown if either <paramref name="width"/> or <paramref name="height"/> are less than or equal to 0.
|
|
/// </exception>
|
|
/// <exception cref="System.ArgumentException">
|
|
/// Thrown if the <paramref name="pixels"/> length is not equal to Width * Height.
|
|
/// </exception>
|
|
void SetPixels(int width, int height, TColor[] pixels);
|
|
|
|
/// <summary>
|
|
/// Sets the pixel array of the image to the given value, creating a copy of
|
|
/// the original pixels.
|
|
/// </summary>
|
|
/// <param name="width">The new width of the image. Must be greater than zero.</param>
|
|
/// <param name="height">The new height of the image. Must be greater than zero.</param>
|
|
/// <param name="pixels">The array with pixels. Must be a multiple of four times the width and height.</param>
|
|
/// <exception cref="System.ArgumentOutOfRangeException">
|
|
/// Thrown if either <paramref name="width"/> or <paramref name="height"/> are less than or equal to 0.
|
|
/// </exception>
|
|
/// <exception cref="System.ArgumentException">
|
|
/// Thrown if the <paramref name="pixels"/> length is not equal to Width * Height.
|
|
/// </exception>
|
|
void ClonePixels(int width, int height, TColor[] pixels);
|
|
|
|
/// <summary>
|
|
/// Locks the image providing access to the pixels.
|
|
/// <remarks>
|
|
/// It is imperative that the accessor is correctly disposed off after use.
|
|
/// </remarks>
|
|
/// </summary>
|
|
/// <returns>The <see cref="PixelAccessor{TColor,TPacked}"/></returns>
|
|
PixelAccessor<TColor, TPacked> Lock();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Encapsulates the basic properties and methods required to manipulate images.
|
|
/// </summary>
|
|
public interface IImageBase
|
|
{
|
|
/// <summary>
|
|
/// Gets the <see cref="Rectangle"/> representing the bounds of the image.
|
|
/// </summary>
|
|
Rectangle Bounds { get; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the quality of the image. This affects the output quality of lossy image formats.
|
|
/// </summary>
|
|
int Quality { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the frame delay for animated images.
|
|
/// If not 0, this field specifies the number of hundredths (1/100) of a second to
|
|
/// wait before continuing with the processing of the Data Stream.
|
|
/// The clock starts ticking immediately after the graphic is rendered.
|
|
/// </summary>
|
|
int FrameDelay { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum allowable width in pixels.
|
|
/// </summary>
|
|
int MaxWidth { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum allowable height in pixels.
|
|
/// </summary>
|
|
int MaxHeight { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets the width in pixels.
|
|
/// </summary>
|
|
int Width { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the height in pixels.
|
|
/// </summary>
|
|
int Height { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the pixel ratio made up of the width and height.
|
|
/// </summary>
|
|
double PixelRatio { get; }
|
|
}
|
|
}
|