Pixel Data JS - v0.28.0
    Preparing search index...

    Function extractMaskBuffer

    • Extracts a rectangular region from a 1D Uint8Array mask. This utility calculates the necessary offsets based on the maskWidth to slice out a specific area.

      Parameters

      • maskBuffer: Uint8Array

        The source 1D array representing the full 2D mask.

      • maskWidth: number

        The width of the original source mask (stride).

      • rect: Rect

        A Rect object defining the region to extract.

      Returns Uint8Array

      A new Uint8Array containing the extracted region.

    • Parameters

      • maskBuffer: Uint8Array

        The source 1D array representing the full 2D mask.

      • maskWidth: number

        The width of the original source mask (stride).

      • x: number

        The starting horizontal coordinate.

      • y: number

        The starting vertical coordinate.

      • w: number

        The width of the region to extract.

      • h: number

        The height of the region to extract.

      Returns Uint8Array

      A new Uint8Array containing the extracted region.