Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...
    • Flip a row-major RGBA pixel buffer vertically.

      WebGL's gl.readPixels returns rows in bottom-up order (y=0 at the bottom of the framebuffer); a Canvas2D ImageData expects top-down (y=0 at the top). This routine swaps rows in-place by row-block copy. It does not change RGBA component order — only the row order.

      The output is Uint8ClampedArray because that's what ImageData requires; clamping is a no-op here since the input is already Uint8 (no values outside [0, 255]).

      Parameters

      • pixels: Uint8Array

        Source row-major RGBA pixel buffer (4 bytes/pixel).

      • width: number

        Image width in pixels.

      • height: number

        Image height in pixels.

      Returns Uint8ClampedArray

      Vertically-flipped buffer as Uint8ClampedArray.