Browse Source

Improve IImageFrameCollection doc comments

pull/539/head
Jesse Gielen 8 years ago
parent
commit
378f5f4a1d
  1. 56
      src/ImageSharp/IImageFrameCollection.cs
  2. 5
      src/ImageSharp/ImageFrameCollection.cs

56
src/ImageSharp/IImageFrameCollection.cs

@ -9,14 +9,14 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp namespace SixLabors.ImageSharp
{ {
/// <summary> /// <summary>
/// Encapsulates an imaged collection of frames. /// Encapsulates a collection of <see cref="ImageFrame{T}"/> instances that make up an <see cref="Image{T}"/>.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the pixel.</typeparam> /// <typeparam name="TPixel">The type of the pixel.</typeparam>
public interface IImageFrameCollection<TPixel> : IEnumerable<ImageFrame<TPixel>> public interface IImageFrameCollection<TPixel> : IEnumerable<ImageFrame<TPixel>>
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
/// <summary> /// <summary>
/// Gets the count. /// Gets the number of frames.
/// </summary> /// </summary>
int Count { get; } int Count { get; }
@ -36,30 +36,31 @@ namespace SixLabors.ImageSharp
ImageFrame<TPixel> this[int index] { get; } ImageFrame<TPixel> this[int index] { get; }
/// <summary> /// <summary>
/// Clones the the frame at <paramref name="index"/> and generates a new images with all the same metadata from the orgional but with only the single frame on it. /// Creates an <see cref="Image{T}"/> with only the frame at the specified index
/// with the same metadata as the original image.
/// </summary> /// </summary>
/// <param name="index"> The zero-based index at which item should be removed.</param> /// <param name="index">The zero-based index of the frame to clone.</param>
/// <exception cref="InvalidOperationException">Cannot remove last frame.</exception> /// <returns>The new <see cref="Image{TPixel}"/> with the specified frame.</returns>
/// <returns>The new <see cref="Image{TPixel}"/> with only the one frame on it.</returns>
Image<TPixel> CloneFrame(int index); Image<TPixel> CloneFrame(int index);
/// <summary> /// <summary>
/// Removed the frame at <paramref name="index"/> and generates a new images with all the same metadata from the orgional but with only the single frame on it. /// Removes the frame at the specified index and creates a new image with only the removed frame
/// with the same metadata as the original image.
/// </summary> /// </summary>
/// <param name="index"> The zero-based index at which item should be removed.</param> /// <param name="index">The zero-based index of the frame to export.</param>
/// <exception cref="InvalidOperationException">Cannot remove last frame.</exception> /// <exception cref="InvalidOperationException">Cannot remove last frame.</exception>
/// <returns>The new <see cref="Image{TPixel}"/> with only the one frame on it.</returns> /// <returns>The new <see cref="Image{TPixel}"/> with the specified frame.</returns>
Image<TPixel> ExportFrame(int index); Image<TPixel> ExportFrame(int index);
/// <summary> /// <summary>
/// Remove the frame at <paramref name="index"/> and frees all freeable resources associated with it. /// Removes the frame at the specified index and frees all freeable resources associated with it.
/// </summary> /// </summary>
/// <param name="index"> The zero-based index at which item should be removed.</param> /// <param name="index">The zero-based index of the frame to remove.</param>
/// <exception cref="InvalidOperationException">Cannot remove last frame.</exception> /// <exception cref="InvalidOperationException">Cannot remove last frame.</exception>
void RemoveFrame(int index); void RemoveFrame(int index);
/// <summary> /// <summary>
/// Creates a new <seealso cref="ImageFrame{TPixel}"/> and appends it appends it to the end of the collection. /// Creates a new <seealso cref="ImageFrame{TPixel}"/> and appends it to the end of the collection.
/// </summary> /// </summary>
/// <returns>The new <see cref="ImageFrame{TPixel}"/>.</returns> /// <returns>The new <see cref="ImageFrame{TPixel}"/>.</returns>
ImageFrame<TPixel> CreateFrame(); ImageFrame<TPixel> CreateFrame();
@ -67,48 +68,47 @@ namespace SixLabors.ImageSharp
/// <summary> /// <summary>
/// Clones the <paramref name="source"/> frame and appends the clone to the end of the collection. /// Clones the <paramref name="source"/> frame and appends the clone to the end of the collection.
/// </summary> /// </summary>
/// <param name="source">The raw pixel data to generate <seealso cref="ImageFrame{TPixel}"/> from.</param> /// <param name="source">The raw pixel data to generate the <seealso cref="ImageFrame{TPixel}"/> from.</param>
/// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns> /// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns>
ImageFrame<TPixel> AddFrame(ImageFrame<TPixel> source); ImageFrame<TPixel> AddFrame(ImageFrame<TPixel> source);
/// <summary> /// <summary>
/// Creates a new frame from the pixel data at the same dimensions at the current image and inserts the new frame /// Creates a new frame from the pixel data with the same dimensions as the other frames and inserts the
/// into the <seealso cref="Image{TPixel}"/> at the end of the collection. /// new frame at the end of the collection.
/// </summary> /// </summary>
/// <param name="source">The raw pixel data to generate <seealso cref="ImageFrame{TPixel}"/> from.</param> /// <param name="source">The raw pixel data to generate the <seealso cref="ImageFrame{TPixel}"/> from.</param>
/// <returns>The new <see cref="ImageFrame{TPixel}"/>.</returns> /// <returns>The new <see cref="ImageFrame{TPixel}"/>.</returns>
ImageFrame<TPixel> AddFrame(TPixel[] source); ImageFrame<TPixel> AddFrame(TPixel[] source);
/// <summary> /// <summary>
/// Clones and inserts the <paramref name="source"/> into the <seealso cref="Image{TPixel}"/> at the specified <paramref name="index"/>. /// Clones and inserts the <paramref name="source"/> into the <seealso cref="IImageFrameCollection{TPixel}"/> at the specified <paramref name="index"/>.
/// </summary> /// </summary>
/// <param name="index"> The zero-based index at which item should be inserted.</param> /// <param name="index">The zero-based index to insert the frame at.</param>
/// <param name="source">The <seealso cref="ImageFrame{TPixel}"/> to clone and insert into the <seealso cref="Image{TPixel}"/>.</param> /// <param name="source">The <seealso cref="ImageFrame{TPixel}"/> to clone and insert into the <seealso cref="IImageFrameCollection{TPixel}"/>.</param>
/// <exception cref="ArgumentException">Frame must have the same dimensions as the image - frame</exception> /// <exception cref="ArgumentException">Frame must have the same dimensions as the image.</exception>
/// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns> /// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns>
ImageFrame<TPixel> InsertFrame(int index, ImageFrame<TPixel> source); ImageFrame<TPixel> InsertFrame(int index, ImageFrame<TPixel> source);
/// <summary> /// <summary>
/// Moves a <seealso cref="ImageFrame{TPixel}"/> from the <seealso cref="Image{TPixel}"/> at the specified index to the other index. /// Moves an <seealso cref="ImageFrame{TPixel}"/> from <paramref name="sourceIndex"/> to <paramref name="destinationIndex"/>.
/// </summary> /// </summary>
/// <param name="sourceIndex">The zero-based index of the item to move.</param> /// <param name="sourceIndex">The zero-based index of the frame to move.</param>
/// <param name="destinationIndex">The zero-based index of the new index that should be inserted at.</param> /// <param name="destinationIndex">The index to move the frame to.</param>
/// <exception cref="InvalidOperationException">Cannot remove last frame.</exception>
void MoveFrame(int sourceIndex, int destinationIndex); void MoveFrame(int sourceIndex, int destinationIndex);
/// <summary> /// <summary>
/// Determines the index of a specific <paramref name="frame"/> in the <seealso cref="Image{TPixel}"/>. /// Determines the index of a specific <paramref name="frame"/> in the <seealso cref="IImageFrameCollection{TPixel}"/>.
/// </summary> /// </summary>
/// <param name="frame">The <seealso cref="ImageFrame{TPixel}"/> to locate in the <seealso cref="Image{TPixel}"/>.</param> /// <param name="frame">The <seealso cref="ImageFrame{TPixel}"/> to locate in the <seealso cref="IImageFrameCollection{TPixel}"/>.</param>
/// <returns>The index of item if found in the list; otherwise, -1.</returns> /// <returns>The index of item if found in the list; otherwise, -1.</returns>
int IndexOf(ImageFrame<TPixel> frame); int IndexOf(ImageFrame<TPixel> frame);
/// <summary> /// <summary>
/// Determines whether the <seealso cref="Image{TPixel}"/> contains the <paramref name="frame"/>. /// Determines whether the <seealso cref="IImageFrameCollection{TPixel}"/> contains the <paramref name="frame"/>.
/// </summary> /// </summary>
/// <param name="frame">The frame.</param> /// <param name="frame">The frame.</param>
/// <returns> /// <returns>
/// <c>true</c> if the <seealso cref="Image{TPixel}"/> the specified frame; otherwise, <c>false</c>. /// <c>true</c> if the <seealso cref="IImageFrameCollection{TPixel}"/> contains the specified frame; otherwise, <c>false</c>.
/// </returns> /// </returns>
bool Contains(ImageFrame<TPixel> frame); bool Contains(ImageFrame<TPixel> frame);
} }

5
src/ImageSharp/ImageFrameCollection.cs

@ -9,10 +9,7 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp namespace SixLabors.ImageSharp
{ {
/// <summary> /// <inheritdoc/>
/// Encapsulates a collection of frames that make up an image.
/// </summary>
/// <typeparam name="TPixel">The type of the pixel.</typeparam>
internal sealed class ImageFrameCollection<TPixel> : IImageFrameCollection<TPixel> internal sealed class ImageFrameCollection<TPixel> : IImageFrameCollection<TPixel>
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {

Loading…
Cancel
Save