TextureExtensions.GetPixelCoordinates

Extension Method in TextureExtensions

Declaration

public static void GetPixelCoordinates(this Texture2D texture, float u, float v, out int px, out int py)

Description

Maps the UV coordinates in the range [0..1] to pixel coordinates in the range [0..width-1] and [0..height-1].

Parameters

textureThe texture to get the pixel coordinates from.
uThe UV coordinate in the x-axis.
vThe UV coordinate in the y-axis.
pxThe output pixel coordinate in the x-axis.
pyThe output pixel coordinate in the y-axis.