Table of Contents

Enum JxlLayerBlend

Namespace
Egami.Formats.Jxl
Assembly
Egami.dll

How a JPEG XL layer combines with the canvas below it (F.2).

public enum JxlLayerBlend

Fields

Add = 1

The layer's samples are added to the canvas's.

Blend = 2

The layer is alpha-blended over the canvas.

MulAdd = 3

The layer, weighted by its alpha, is added to the canvas.

Multiply = 4

The canvas is multiplied by the layer.

Replace = 0

The layer replaces the canvas.

Examples

// An animation loads as its frames, blended onto the canvas, each with its delay.
using Raster animation = Raster.Load("sprite.jxl");
int frames = animation.FrameCount;

// The layers before blending, for an editor: each at its own size and place.
IReadOnlyList<JxlLayer> layers = JxlImage.ReadLayers("sprite.jxl");
foreach (JxlLayer layer in layers)
{
    Console.WriteLine($"{layer.Raster.Width}x{layer.Raster.Height} at {layer.X},{layer.Y}: {layer.Blend}, {layer.Duration.TotalMilliseconds} ms");
    layer.Dispose();
}

// The preview some files carry for quick display, or null.
using Raster? preview = JxlImage.ReadPreview("duck.jxl");

// A lossy still at an eighth of its size, from its LF image alone.
using Raster thumbnail = Raster.Load("duck.jxl", options: new JxlReaderOptions { MaxDownscale = 8 });