PeachImage
PeachImage.Formats.Png.PngAlphaSplit
PngAlphaSplit.TrySplit(PngPassthroughInfo, PngAlphaSplitInfo) Method
Attempts to split the alpha channel out of an already-read passthrough (e.g. from TryRead(Stream, PngPassthroughInfo)). Returns false (never throws) when the source isn’t eligible.
public static bool TrySplit(in PeachImage.Formats.Png.PngPassthroughInfo passthrough, out PeachImage.Formats.Png.PngAlphaSplitInfo info);
Parameters
passthrough PngPassthroughInfo
info PngAlphaSplitInfo
Returns
Remarks
Eligible sources are color type 4 (GrayscaleAlpha), color type 6 (TruecolorAlpha) — both only at
8-bit depth in this version — or a palette (color type 3) image whose tRNS chunk contains
at least one genuine partial-alpha entry (a byte that is neither 0 nor 255). A palette image
whose transparency is purely binary (every tRNS byte is 0 or 255) is better expressed as a
PDF color-key /Mask built directly from TrnsData, and is
not considered eligible here. Interlaced sources are never eligible: Adam7 sub-image data cannot
be de-interleaved by this simple a row loop.
For the palette case, ColorData is always null
— the color side needs no new data at all; pair the existing
IdatData and PaletteData with a
PDF /Indexed color space as usual, and use only the returned alpha plane as the
/SMask.