From eead4a93615fc6bd71bfa6563c31a47afe701c7f Mon Sep 17 00:00:00 2001 From: winscripter <142818255+winscripter@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:31:31 +0400 Subject: [PATCH] Add ShouldFlip methods, fix typo --- .../Jxl/IO/Metadata/JxlExifOrientation.cs | 2 +- .../RenderPipeline/WriteToOutputStage.cs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Jxl/IO/Metadata/JxlExifOrientation.cs b/src/ImageSharp/Formats/Jxl/IO/Metadata/JxlExifOrientation.cs index 406e7e9a1a..fb7d8d7bba 100644 --- a/src/ImageSharp/Formats/Jxl/IO/Metadata/JxlExifOrientation.cs +++ b/src/ImageSharp/Formats/Jxl/IO/Metadata/JxlExifOrientation.cs @@ -9,7 +9,7 @@ internal enum JxlExifOrientation : byte FlipHorizontal = 2, Rotate180 = 3, FlipVertical = 4, - Transponse = 5, + Transpose = 5, Rotate90 = 6, AntiTranspose = 7, Rotate270 = 8 diff --git a/src/ImageSharp/Formats/Jxl/Processing/RenderPipeline/WriteToOutputStage.cs b/src/ImageSharp/Formats/Jxl/Processing/RenderPipeline/WriteToOutputStage.cs index 09426afb2b..e07be6ec06 100644 --- a/src/ImageSharp/Formats/Jxl/Processing/RenderPipeline/WriteToOutputStage.cs +++ b/src/ImageSharp/Formats/Jxl/Processing/RenderPipeline/WriteToOutputStage.cs @@ -1,6 +1,9 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Formats.Jxl.IO.Metadata; +using SixLabors.ImageSharp.Formats.Jxl.Processing.Image; + namespace SixLabors.ImageSharp.Formats.Jxl.Processing.RenderPipeline; internal sealed class WriteToOutputStage @@ -209,4 +212,22 @@ internal sealed class WriteToOutputStage 0.04825f, -0.07914f, -0.39954f, 0.12160f, 0.29145f, 0.00965f, -0.37638f, 0.32233f, 0.20267f, -0.17564f, 0.39182f, 0.12160f, 0.18336f, 0.32619f, 0.26057f, 0.49219f ]; + + private static bool ShouldFlipX(JxlExifOrientation orientation) => + orientation is JxlExifOrientation.FlipHorizontal or + JxlExifOrientation.Rotate180 or + JxlExifOrientation.Rotate270 or + JxlExifOrientation.AntiTranspose; + + private static bool ShouldFlipY(JxlExifOrientation orientation) => + orientation is JxlExifOrientation.FlipVertical or + JxlExifOrientation.Rotate180 or + JxlExifOrientation.Rotate90 or + JxlExifOrientation.AntiTranspose; + + private static bool ShouldTranspose(JxlExifOrientation orientation) => + orientation is JxlExifOrientation.Transpose or + JxlExifOrientation.Rotate90 or + JxlExifOrientation.Rotate270 or + JxlExifOrientation.AntiTranspose; }