pub fn extract_soft_mask<P: Pixel>(group: &GroupBitmap<P>) -> Vec<u8> ⓘExpand description
Convert a finished group bitmap into a single-channel soft mask.
Returns one byte per pixel (width × height bytes, row-major, top-down):
soft_mask_type | Output |
|---|---|
SoftMaskType::None | All 255 (fully opaque — no masking). |
SoftMaskType::Alpha | Group alpha plane, verbatim. |
SoftMaskType::Luminosity | BT.709 luma (77R + 151G + 28B + 128) >> 8 per RGB pixel. Fallback to alpha for non-RGB groups. |
For SoftMaskType::Luminosity, only 3-byte RGB groups compute a true luma
value. All other pixel modes (gray, CMYK, DeviceN) fall back to the alpha
plane because their channel bytes do not map to R, G, B.