From a1152c5dc3ccfe73ea18b40e5344e76ebb60e68b Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Sun, 29 Mar 2026 19:57:03 +0200 Subject: [PATCH] Add some more comments --- .../Formats/Exr/ExrHeaderAttributes.cs | 37 +++++++++++++++++++ src/ImageSharp/Formats/Exr/ExrUtils.cs | 11 ++++++ .../Formats/Exr/IExrEncoderOptions.cs | 17 --------- 3 files changed, 48 insertions(+), 17 deletions(-) delete mode 100644 src/ImageSharp/Formats/Exr/IExrEncoderOptions.cs diff --git a/src/ImageSharp/Formats/Exr/ExrHeaderAttributes.cs b/src/ImageSharp/Formats/Exr/ExrHeaderAttributes.cs index afda62bf92..cdcddd1175 100644 --- a/src/ImageSharp/Formats/Exr/ExrHeaderAttributes.cs +++ b/src/ImageSharp/Formats/Exr/ExrHeaderAttributes.cs @@ -5,6 +5,10 @@ using SixLabors.ImageSharp.Formats.Exr.Constants; namespace SixLabors.ImageSharp.Formats.Exr; +/// +/// The header of an EXR image. +/// +/// internal class ExrHeaderAttributes { public ExrHeaderAttributes( @@ -33,25 +37,58 @@ internal class ExrHeaderAttributes this.ChunkCount = chunkCount; } + /// + /// Gets or sets a description of the image channels stored in the file. + /// public IList Channels { get; set; } + /// + /// Gets or sets the compression method applied to the pixel data of all channels in the file. + /// public ExrCompression Compression { get; set; } + /// + /// Gets or sets the image’s data window. + /// public ExrBox2i DataWindow { get; set; } + /// + /// Gets or sets the image’s display window. + /// public ExrBox2i DisplayWindow { get; set; } + /// + /// 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). + /// public ExrLineOrder LineOrder { get; set; } + /// + /// Gets or sets the aspect ratio of the image. + /// public float AspectRatio { get; set; } + /// + /// Gets or sets the screen width. + /// public float ScreenWindowWidth { get; set; } + /// + /// Gets or sets the screen window center. + /// public PointF ScreenWindowCenter { get; set; } + /// + /// Gets or sets the number of horizontal tiles. + /// public uint? TileXSize { get; set; } + /// + /// Gets or sets the number of vertical tiles. + /// public uint? TileYSize { get; set; } + /// + /// Gets or sets the chunk count. Indicates the number of chunks in this part. Required if the multipart bit (12) is set. + /// public int? ChunkCount { get; set; } } diff --git a/src/ImageSharp/Formats/Exr/ExrUtils.cs b/src/ImageSharp/Formats/Exr/ExrUtils.cs index 4d172c6ef8..386210b81d 100644 --- a/src/ImageSharp/Formats/Exr/ExrUtils.cs +++ b/src/ImageSharp/Formats/Exr/ExrUtils.cs @@ -7,6 +7,12 @@ namespace SixLabors.ImageSharp.Formats.Exr; internal static class ExrUtils { + /// + /// Calcualtes the required bytes for a pixel row. + /// + /// The image channels array. + /// The width in pixels of a row. + /// The number of bytes per row. public static uint CalculateBytesPerRow(IList channels, uint width) { uint bytesPerRow = 0; @@ -32,6 +38,11 @@ internal static class ExrUtils return bytesPerRow; } + /// + /// Determines how many pixel rows there are in a block. This varies depending on the compression used. + /// + /// The compression used. + /// Pixel rows in a block. public static uint RowsPerBlock(ExrCompression compression) => compression switch { ExrCompression.Zip or ExrCompression.Pxr24 => 16, diff --git a/src/ImageSharp/Formats/Exr/IExrEncoderOptions.cs b/src/ImageSharp/Formats/Exr/IExrEncoderOptions.cs deleted file mode 100644 index 2ccf26ec17..0000000000 --- a/src/ImageSharp/Formats/Exr/IExrEncoderOptions.cs +++ /dev/null @@ -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; - -/// -/// Configuration options for use during OpenExr encoding. -/// -internal interface IExrEncoderOptions -{ - /// - /// Gets the pixel type of the image. - /// - ExrPixelType? PixelType { get; } -}