Function GetElementPixelFromUv
-
GetElementPixelFromUv(
u: number,
v: number,
width: number,
height: number,
invertY?: boolean,
): { x: number; y: number }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 - u: number
Maps a UV coordinate sampled from an HtmlTexture to a pixel position inside the source element.
When
invertYis true (the default, matching HtmlTexture's default upload orientation) the V axis is flipped so thatv = 1maps to the top of the element, matching the top-left origin used by DOM layout.