Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
WoW:API Texture SetTexCoord
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{widgetmethod}} Sets the region of a texture drawn by the {{api|Texture|t=w}} widget. obj:SetTexCoord(left,right,top,bottom) obj:SetTexCoord(ULx,ULy,LLx,LLy,URx,URy,LRx,LRy) == Parameters == === Arguments === :;left, right, top, bottom - number :: side coordinates; top left corner of the image is (0, 0); bottom right corner is (1, 1). :;ULx, ULy, LLx, LLy, URx, URy, LRx, LRy - number :: point coordinates; top left corner of the image is (0, 0); bottom right corner is (1, 1). === Returns === :none == Details == The function can be used to cut a sub-region out of the texture to display in game. == Example == texture:SetTexCoord(0, 0.5, 0.5, 1) Displays the bottom-left quarter of the image. local ULx,ULy,LLx,LLy,URx,URy,LRx,LRy = texture:GetTexCoord() texture:SetTexCoord(ULx*0.5,ULy,LLx*0.5,LLy,URx,URy,LRx,LRy) local w = texture:GetWidth(); texture:SetWidth(w * 0.5) Change the "view" of a texture to the right, to one half, while maintaining aspect ratio and scale. == Notes == * the coordinates are normalized, and that 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 * Unless you want to do rotations, use the ''(left,right,top,bottom)'' notation. * The more complex 8-argument form allows for arbitrary affine transformations, and transformations based on previous values. == See also == * {{api|Texture:GetTexCoord|t=w}}() * [[SetTexCoord Transformations]]
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Api
(
edit
)
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Tocright
(
edit
)
Template:Widget
(
edit
)
Template:Widgetmethod
(
edit
)