Browse Source

Add some more comments

pull/3096/head
Brian Popow 1 month ago
parent
commit
a1152c5dc3
  1. 37
      src/ImageSharp/Formats/Exr/ExrHeaderAttributes.cs
  2. 11
      src/ImageSharp/Formats/Exr/ExrUtils.cs
  3. 17
      src/ImageSharp/Formats/Exr/IExrEncoderOptions.cs

37
src/ImageSharp/Formats/Exr/ExrHeaderAttributes.cs

@ -5,6 +5,10 @@ using SixLabors.ImageSharp.Formats.Exr.Constants;
namespace SixLabors.ImageSharp.Formats.Exr; namespace SixLabors.ImageSharp.Formats.Exr;
/// <summary>
/// The header of an EXR image.
/// <see href="https://openexr.com/en/latest/TechnicalIntroduction.html#header"/>
/// </summary>
internal class ExrHeaderAttributes internal class ExrHeaderAttributes
{ {
public ExrHeaderAttributes( public ExrHeaderAttributes(
@ -33,25 +37,58 @@ internal class ExrHeaderAttributes
this.ChunkCount = chunkCount; this.ChunkCount = chunkCount;
} }
/// <summary>
/// Gets or sets a description of the image channels stored in the file.
/// </summary>
public IList<ExrChannelInfo> Channels { get; set; } public IList<ExrChannelInfo> Channels { get; set; }
/// <summary>
/// Gets or sets the compression method applied to the pixel data of all channels in the file.
/// </summary>
public ExrCompression Compression { get; set; } public ExrCompression Compression { get; set; }
/// <summary>
/// Gets or sets the image’s data window.
/// </summary>
public ExrBox2i DataWindow { get; set; } public ExrBox2i DataWindow { get; set; }
/// <summary>
/// Gets or sets the image’s display window.
/// </summary>
public ExrBox2i DisplayWindow { get; set; } public ExrBox2i DisplayWindow { get; set; }
/// <summary>
/// Gets or sets in what order the scan lines in the file are stored in the file (increasing Y, decreasing Y, or, for tiled images, also random Y).
/// </summary>
public ExrLineOrder LineOrder { get; set; } public ExrLineOrder LineOrder { get; set; }
/// <summary>
/// Gets or sets the aspect ratio of the image.
/// </summary>
public float AspectRatio { get; set; } public float AspectRatio { get; set; }
/// <summary>
/// Gets or sets the screen width.
/// </summary>
public float ScreenWindowWidth { get; set; } public float ScreenWindowWidth { get; set; }
/// <summary>
/// Gets or sets the screen window center.
/// </summary>
public PointF ScreenWindowCenter { get; set; } public PointF ScreenWindowCenter { get; set; }
/// <summary>
/// Gets or sets the number of horizontal tiles.
/// </summary>
public uint? TileXSize { get; set; } public uint? TileXSize { get; set; }
/// <summary>
/// Gets or sets the number of vertical tiles.
/// </summary>
public uint? TileYSize { get; set; } public uint? TileYSize { get; set; }
/// <summary>
/// Gets or sets the chunk count. Indicates the number of chunks in this part. Required if the multipart bit (12) is set.
/// </summary>
public int? ChunkCount { get; set; } public int? ChunkCount { get; set; }
} }

11
src/ImageSharp/Formats/Exr/ExrUtils.cs

@ -7,6 +7,12 @@ namespace SixLabors.ImageSharp.Formats.Exr;
internal static class ExrUtils internal static class ExrUtils
{ {
/// <summary>
/// Calcualtes the required bytes for a pixel row.
/// </summary>
/// <param name="channels">The image channels array.</param>
/// <param name="width">The width in pixels of a row.</param>
/// <returns>The number of bytes per row.</returns>
public static uint CalculateBytesPerRow(IList<ExrChannelInfo> channels, uint width) public static uint CalculateBytesPerRow(IList<ExrChannelInfo> channels, uint width)
{ {
uint bytesPerRow = 0; uint bytesPerRow = 0;
@ -32,6 +38,11 @@ internal static class ExrUtils
return bytesPerRow; return bytesPerRow;
} }
/// <summary>
/// Determines how many pixel rows there are in a block. This varies depending on the compression used.
/// </summary>
/// <param name="compression">The compression used.</param>
/// <returns>Pixel rows in a block.</returns>
public static uint RowsPerBlock(ExrCompression compression) => compression switch public static uint RowsPerBlock(ExrCompression compression) => compression switch
{ {
ExrCompression.Zip or ExrCompression.Pxr24 => 16, ExrCompression.Zip or ExrCompression.Pxr24 => 16,

17
src/ImageSharp/Formats/Exr/IExrEncoderOptions.cs

@ -1,17 +0,0 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Formats.Exr.Constants;
namespace SixLabors.ImageSharp.Formats.Exr;
/// <summary>
/// Configuration options for use during OpenExr encoding.
/// </summary>
internal interface IExrEncoderOptions
{
/// <summary>
/// Gets the pixel type of the image.
/// </summary>
ExrPixelType? PixelType { get; }
}
Loading…
Cancel
Save