-
-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into js/fix-2595
- Loading branch information
Showing
16 changed files
with
584 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
namespace SixLabors.ImageSharp.Metadata.Profiles.Cicp; | ||
|
||
/// <summary> | ||
/// Represents a Cicp profile as per ITU-T H.273 / ISO/IEC 23091-2_2019 providing access to color space information | ||
/// </summary> | ||
public sealed class CicpProfile : IDeepCloneable<CicpProfile> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CicpProfile"/> class. | ||
/// </summary> | ||
public CicpProfile() | ||
: this(2, 2, 2, null) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CicpProfile"/> class. | ||
/// </summary> | ||
/// <param name="colorPrimaries">The color primaries as number according to ITU-T H.273 / ISO/IEC 23091-2_2019.</param> | ||
/// <param name="transferCharacteristics">The transfer characteristics as number according to ITU-T H.273 / ISO/IEC 23091-2_2019.</param> | ||
/// <param name="matrixCoefficients">The matrix coefficients as number according to ITU-T H.273 / ISO/IEC 23091-2_2019.</param> | ||
/// <param name="fullRange">The full range flag, or null if unknown.</param> | ||
public CicpProfile(byte colorPrimaries, byte transferCharacteristics, byte matrixCoefficients, bool? fullRange) | ||
{ | ||
this.ColorPrimaries = Enum.IsDefined(typeof(CicpColorPrimaries), colorPrimaries) ? (CicpColorPrimaries)colorPrimaries : CicpColorPrimaries.Unspecified; | ||
this.TransferCharacteristics = Enum.IsDefined(typeof(CicpTransferCharacteristics), transferCharacteristics) ? (CicpTransferCharacteristics)transferCharacteristics : CicpTransferCharacteristics.Unspecified; | ||
this.MatrixCoefficients = Enum.IsDefined(typeof(CicpMatrixCoefficients), matrixCoefficients) ? (CicpMatrixCoefficients)matrixCoefficients : CicpMatrixCoefficients.Unspecified; | ||
this.FullRange = fullRange ?? (this.MatrixCoefficients == CicpMatrixCoefficients.Identity); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CicpProfile"/> class | ||
/// by making a copy from another CICP profile. | ||
/// </summary> | ||
/// <param name="other">The other CICP profile, where the clone should be made from.</param> | ||
/// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>> | ||
private CicpProfile(CicpProfile other) | ||
{ | ||
Guard.NotNull(other, nameof(other)); | ||
|
||
this.ColorPrimaries = other.ColorPrimaries; | ||
this.TransferCharacteristics = other.TransferCharacteristics; | ||
this.MatrixCoefficients = other.MatrixCoefficients; | ||
this.FullRange = other.FullRange; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the color primaries | ||
/// </summary> | ||
public CicpColorPrimaries ColorPrimaries { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the transfer characteristics | ||
/// </summary> | ||
public CicpTransferCharacteristics TransferCharacteristics { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the matrix coefficients | ||
/// </summary> | ||
public CicpMatrixCoefficients MatrixCoefficients { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the colors use the full numeric range | ||
/// </summary> | ||
public bool FullRange { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public CicpProfile DeepClone() => new(this); | ||
} |
86 changes: 86 additions & 0 deletions
86
src/ImageSharp/Metadata/Profiles/CICP/Enums/CicpColorPrimaries.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
namespace SixLabors.ImageSharp.Metadata.Profiles.Cicp; | ||
|
||
#pragma warning disable CA1707 // Underscores in enum members | ||
|
||
/// <summary> | ||
/// Color primaries according to ITU-T H.273 / ISO/IEC 23091-2_2019 subclause 8.1 | ||
/// </summary> | ||
public enum CicpColorPrimaries : byte | ||
{ | ||
/// <summary> | ||
/// Rec. ITU-R BT.709-6 | ||
/// IEC 61966-2-1 sRGB or sYCC | ||
/// IEC 61966-2-4 | ||
/// SMPTE RP 177 (1993) Annex B | ||
/// </summary> | ||
ItuRBt709_6 = 1, | ||
|
||
/// <summary> | ||
/// Image characteristics are unknown or are determined by the application. | ||
/// </summary> | ||
Unspecified = 2, | ||
|
||
/// <summary> | ||
/// Rec. ITU-R BT.470-6 System M (historical) | ||
/// </summary> | ||
ItuRBt470_6M = 4, | ||
|
||
/// <summary> | ||
/// Rec. ITU-R BT.601-7 625 | ||
/// Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM | ||
/// </summary> | ||
ItuRBt601_7_625 = 5, | ||
|
||
/// <summary> | ||
/// Rec. ITU-R BT.601-7 525 | ||
/// Rec. ITU-R BT.1700-0 NTSC | ||
/// SMPTE ST 170 (2004) | ||
/// (functionally the same as the value 7) | ||
/// </summary> | ||
ItuRBt601_7_525 = 6, | ||
|
||
/// <summary> | ||
/// SMPTE ST 240 (1999) | ||
/// (functionally the same as the value 6) | ||
/// </summary> | ||
SmpteSt240 = 7, | ||
|
||
/// <summary> | ||
/// Generic film (colour filters using Illuminant C) | ||
/// </summary> | ||
GenericFilm = 8, | ||
|
||
/// <summary> | ||
/// Rec. ITU-R BT.2020-2 | ||
/// Rec. ITU-R BT.2100-2 | ||
/// </summary> | ||
ItuRBt2020_2 = 9, | ||
|
||
/// <summary> | ||
/// SMPTE ST 428-1 (2019) | ||
/// (CIE 1931 XYZ as in ISO 11664-1) | ||
/// </summary> | ||
SmpteSt428_1 = 10, | ||
|
||
/// <summary> | ||
/// SMPTE RP 431-2 (2011) | ||
/// DCI P3 | ||
/// </summary> | ||
SmpteRp431_2 = 11, | ||
|
||
/// <summary> | ||
/// SMPTE ST 432-1 (2010) | ||
/// P3 D65 / Display P3 | ||
/// </summary> | ||
SmpteEg432_1 = 12, | ||
|
||
/// <summary> | ||
/// EBU Tech.3213-E | ||
/// </summary> | ||
EbuTech3213E = 22, | ||
} | ||
|
||
#pragma warning restore CA1707 // Underscores in enum members |
Oops, something went wrong.