API

Function GetElementPixelFromUv

  • Maps a UV coordinate sampled from an HtmlTexture to a pixel position inside the source element.

    When invertY is true (the default, matching HtmlTexture's default upload orientation) the V axis is flipped so that v = 1 maps to the top of the element, matching the top-left origin used by DOM layout.

    Parameters

    • u: number

      horizontal texture coordinate, normally in [0, 1]

    • v: number

      vertical texture coordinate, normally in [0, 1]

    • width: number

      element width in pixels

    • height: number

      element height in pixels

    • invertY: boolean = true

      whether the texture content is stored Y-inverted (default true)

    Returns { x: number; y: number }

    the pixel position { x, y } within the element