TextureBase:GetTexCoord

From Warcraft Wiki
Jump to navigation Jump to search

Returns the texture space coordinates of the texture.

ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = TextureBase:GetTexCoord()

Returns

Coordinates of the four (transformed) image corners.

ULx: number - Upper left corner X position, as a fraction of the image's width from the left.
ULy: number - Upper left corner Y position, as a fraction of the image's height from the top.
LLx: number - Lower left corner X position, as a fraction of the image's width from the left.
LLy: number - Lower left corner Y position, as a fraction of the image's height from the top.
URx: number - Upper right corner X position, as a fraction of the image's width from the left.
URy: number - Upper right corner Y position, as a fraction of the image's height from the top.
LRx: number - Lower right corner X position, as a fraction of the image's width from the left.
LRy: number - Lower right corner Y position, as a fraction of the image's height from the top.

Example

If you simply want to get back the left, right, top, bottom coordinates for use in :SetTexCoord instead of using eight coordinates, but it's really up to preference.

local tex = UIParent:CreateTexture()
tex:SetPoint("CENTER")
tex:SetTexture("interface/icons/inv_mushroom_11")

local left, top, _, bottom, right = tex:GetTexCoord()
print(left, right, top, bottom) -- 0, 1, 0, 1