WoW:API Texture GetTexCoord: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Created page with "{{widgetmethod}} Gets the texture coordinates of a texture. Texture coordinates change the region of, or distort, the drawn texture. local ULx,ULy,LLx,LLy,URx,URy,LRx,LRy =...")
 
m (Move page script moved page API Texture GetTexCoord to API Texture GetTexCoord without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{widgetmethod}}
{{widgetmethod}}Gets the texture coordinates of a {{api|Texture|t=w}}.
Gets the texture coordinates of a {{api|Texture|t=w}}.


  local ULx,ULy,LLx,LLy,URx,URy,LRx,LRy = obj:SetTexCoord()
  local ULx,ULy,LLx,LLy,URx,URy,LRx,LRy = obj:GetTexCoord()


== Parameters ==
== Parameters ==
Line 10: Line 9:
=== Returns ===
=== Returns ===
:;ULx,ULy,LLx,LLy,URx,URy,LRx,LRy - number
:;ULx,ULy,LLx,LLy,URx,URy,LRx,LRy - number
:: point coordinates; top left corner of the image is (0, 0); bottom right corner  
:: point coordinates; top left corner of the image is (0, 0); bottom right corner


== Details ==
== Details ==

Latest revision as of 04:47, 15 August 2023

Widget API ← Texture < GetTexCoordGets the texture coordinates of a Texture.

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

Parameters[edit]

Arguments[edit]

none

Returns[edit]

ULx,ULy,LLx,LLy,URx,URy,LRx,LRy - number
point coordinates; top left corner of the image is (0, 0); bottom right corner

Details[edit]

Texture coordinates change the region of, or distort, the drawn texture. Texture coordinates can be used to display a sub-region of a texture.

Examples[edit]

Displays the bottom-left quarter of the image.

texture:SetTexCoord(0, 0.5, 0.5, 1);

Notes[edit]

  • coordinates are normalized and the origin is the top-left corner
  • Tested in patch 2.0.6, and the origin is in fact in the top left, and not the bottom left as was previously stated.

See also[edit]