Documentation
    Preparing search index...

    Interface PickableAlphaMask

    §71's "pixel" strategy for the CPU-resident case (RFC 0005 alternative D, adopted): the texels a candidate's visible shape comes from, so a bounds hit can be confirmed — or rejected — by the alpha actually under the point.

    The common carrier is a §55 sprite: its TextureSource.data is already CPU-side RGBA8, so a transparent corner of a quad stops picking without a renderer, a read-back, or a new package edge — which is why this tier lives here and the id-buffer tier does not. It composes with the box test rather than replacing it: the box says where the ray meets the candidate, the mask says whether that texel is really there.

    The box entry point's local x/y are normalized against the box extents to u/v in [0, 1] (an axis of zero extent — a flat sprite's thickness — reads as 0), then nearest-sampled: u maps across PickableAlphaMask.region's columns, v across its rows, row 0 being the box's −Y edge — exactly the orientation texImage2D gives the same array, so what picks is what shows. The hit is kept when the sampled alpha is strictly greater than PickableAlphaMask.threshold.

    interface PickableAlphaMask {
        data: Uint8Array<ArrayBufferLike> | Uint8ClampedArray<ArrayBufferLike>;
        height: number;
        region?: { height: number; width: number; x: number; y: number };
        threshold?: number;
        width: number;
    }
    Index
    data: Uint8Array<ArrayBufferLike> | Uint8ClampedArray<ArrayBufferLike>

    RGBA8 texels, row-major, 4 bytes per texel — TextureSource.data's layout, and usually that very array.

    height: number

    Height of data in texels. A positive integer (§85).

    region?: { height: number; width: number; x: number; y: number }

    The sub-rectangle of data the candidate's shape shows, in texels — §55's frame, for a sprite that atlases. Absent means all of data. Must lie inside width × height (§85).

    threshold?: number

    Alpha in [0, 1] a texel must exceed to count as present. Defaults to 0 — any nonzero alpha picks, which is §71's reading of "pixel-alpha testing"; raise it to ignore soft edges.

    width: number

    Width of data in texels. A positive integer (§85).