Skip to content

TicketLayer

Namespace Nfty.Ticket in assembly Nfty.Ticket.

public readonly struct TicketLayer : IEquatable<TicketLayer>

What one layer contributed to a rolled asset.

Constructors

TicketLayer(string, string, double?, double?, ColorModel?, LayerKind, int, int)

public TicketLayer(string IngredientId, string VariantId, double? Hue, double? Sat, ColorModel? Model, LayerKind Kind, int HueQuantize, int SatQuantize);

Parameters

  • IngredientId (string) - The layer.
  • VariantId (string) - The variant rolled.
  • Hue (double?) - The rolled hue in degrees, or null for a Custom layer.
  • Sat (double?) - The rolled saturation as a 0..1 fraction, or null for a Custom layer.
  • Model (ColorModel?) - The color space, or null for a Custom layer. Carried so a ticket can be verified standalone; NOT part of the DNA hash (Dna.Compute hashes the ingredient id, variant id and quantized hue/saturation only), so this field is not authoritative — a renderer takes the color model from the Menu, where it is fixed per (recipeId, ingredientId) and cannot legitimately vary per asset.
  • Kind (LayerKind) - Dynamic, Static or Custom. Carried so a ticket can be verified standalone; NOT part of the DNA hash, so this field is not authoritative — the same boundary as Model above.
  • HueQuantize (int) - The layer's hue bucket width, carried so the DNA can be recomputed from the ticket alone. Not authoritative: Plating.Plate refuses a ticket whose quantize differs from the Menu's.
  • SatQuantize (int) - The layer's saturation bucket width, likewise.

Properties

Hue

public double? Hue { get; init; }

The rolled hue in degrees, or null for a Custom layer.

HueQuantize

public int HueQuantize { get; init; }

The layer's hue bucket width, carried so the DNA can be recomputed from the ticket alone. Not authoritative: Plating.Plate refuses a ticket whose quantize differs from the Menu's.

IngredientId

public string IngredientId { get; init; }

The layer.

Kind

public LayerKind Kind { get; init; }

Dynamic, Static or Custom. Carried so a ticket can be verified standalone; NOT part of the DNA hash, so this field is not authoritative — the same boundary as Model above.

Model

public ColorModel? Model { get; init; }

The color space, or null for a Custom layer. Carried so a ticket can be verified standalone; NOT part of the DNA hash (Dna.Compute hashes the ingredient id, variant id and quantized hue/saturation only), so this field is not authoritative — a renderer takes the color model from the Menu, where it is fixed per (recipeId, ingredientId) and cannot legitimately vary per asset.

Sat

public double? Sat { get; init; }

The rolled saturation as a 0..1 fraction, or null for a Custom layer.

SatQuantize

public int SatQuantize { get; init; }

The layer's saturation bucket width, likewise.

VariantId

public string VariantId { get; init; }

The variant rolled.