diff --git a/src/ImageSharp/Formats/Jxl/Memory/JxlImage3{T}.cs b/src/ImageSharp/Formats/Jxl/Memory/JxlImage3{T}.cs index 9e9b10c09..91aed2e97 100644 --- a/src/ImageSharp/Formats/Jxl/Memory/JxlImage3{T}.cs +++ b/src/ImageSharp/Formats/Jxl/Memory/JxlImage3{T}.cs @@ -46,6 +46,13 @@ internal class JxlImage3 : IDisposable return rowSpan; } + public Span PlaneRow(Rectangle rectangle, int c, int y) + { + DebugGuard.MustBeGreaterThanOrEqualTo(y + rectangle.Top, 0, nameof(y)); + + return this.PlaneRow(c, y + rectangle.Top)[rectangle.Left..]; + } + public JxlPlane Plane(int index) => this.planes[index]; public void Swap(JxlImage3 other) diff --git a/src/ImageSharp/Formats/Jxl/Memory/JxlPlane{T}.cs b/src/ImageSharp/Formats/Jxl/Memory/JxlPlane{T}.cs index 7326768f0..e61381b19 100644 --- a/src/ImageSharp/Formats/Jxl/Memory/JxlPlane{T}.cs +++ b/src/ImageSharp/Formats/Jxl/Memory/JxlPlane{T}.cs @@ -36,6 +36,17 @@ internal class JxlPlane : JxlPlaneBase public Span GetRow(int y) => this.GetRowBase(y); + public Span GetRow(Rectangle rectangle, int y) + { + DebugGuard.MustBeGreaterThanOrEqualTo(y + rectangle.Top, 0, nameof(y)); + + return this.GetRow(y + rectangle.Top)[rectangle.Left..]; + } + + public bool IsRectangleInside(Rectangle rectangle) => rectangle.Contains(this.GetRectangle()); + + public Rectangle GetRectangle() => new(0, 0, this.XSize, this.YSize); + /// /// Fills everything in this image with 0. ///