Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
No edit summary
Tag: WoW API docs
No edit summary
Tag: WoW API docs
Line 44: Line 44:
 
: {{api|t=w|Texture:SetVertTile(horizTile)}} - Sets whether the widget should adjust vertical texture coordinates based on texture and widget dimensions.
 
: {{api|t=w|Texture:SetVertTile(horizTile)}} - Sets whether the widget should adjust vertical texture coordinates based on texture and widget dimensions.
 
}}</onlyinclude>
 
}}</onlyinclude>
  +
  +
== Example ==
  +
Creates a frame with {{api|CreateFrame}}() and then a texture with {{api|t=w|Frame:CreateTexture}}()
  +
[[File:API_CreateFrame_mushroom.png|thumb|right|[https://github.com/Gethe/wow-ui-textures/blob/live/ICONS/INV_Mushroom_11.PNG inv_mushroom_11]]]
  +
<syntaxhighlight lang="lua">
  +
local f = CreateFrame("Frame", nil, UIParent)
  +
f:SetPoint("CENTER")
  +
f:SetSize(64, 64)
  +
  +
local tex = f:CreateTexture()
  +
tex:SetAllPoints(f)
  +
tex:SetTexture("interface/icons/inv_mushroom_11")
  +
</syntaxhighlight>
   
 
== External links ==
 
== External links ==

Revision as of 06:44, 30 December 2020

Texture (inherits from LayeredRegion) are visible areas that display either a color block, a gradient, or a graphic raster taken from a .tga, .blp or .jpg file. Most of their methods relate to setting their appearance or their source information.

Textures are created as children of Frame elements in XML, or by calling Frame:CreateTexture() from Lua. They cannot be reassigned from one frame to another, although you can create another texture on another frame that has the same source. They can also be created in XML with the virtual tag, allowing several similar textures to be created easily.

Defined Methods

Texture:AddMaskTexture(maskTexture)
Texture:GetAtlas()
Texture:GetBlendMode() - Returns the AlphaMode.
Texture:GetDesaturation()
Texture:GetHorizTile()
Texture:GetMaskTexture(index)
Texture:GetNonBlocking()
Texture:GetNumMaskTextures()
Texture:GetRotation()
Texture:GetTexCoord() - Gets the 8 texture coordinates that map to the Texture's corners - New in 1.11.
Texture:GetTexelSnappingBias()
Texture:GetTexture() - Gets this texture's current texture path.
Texture:GetTextureFileID()
Texture:GetTextureFilePath()
Texture:GetVertexColor() - Gets the vertex color for the Texture.
Texture:GetVertexOffset(vertexIndex)
Texture:GetVertTile()
Texture:IsDesaturated() - Gets the desaturation state of this Texture. - New in 1.11
Texture:IsSnappingToPixelGrid()
Texture:RemoveMaskTexture(maskTexture)
Texture:SetAtlas(atlasName [, useAtlasSize, filterMode])
Texture:SetBlendMode(mode) - Defines the AlphaMode.
Texture:SetColorTexture(r, g, b [, a]) - Creates a solid-color texture
Texture:SetDesaturated(flag) - Set whether this texture should be displayed with no saturation (Note: This has a return value)
Texture:SetDesaturation()
Texture:SetGradient(orientation, minR, minG, minB, maxR, maxG, maxB)
Texture:SetGradientAlpha(orientation, minR, minG, minB, minA, maxR, maxG, maxB, maxA)
Texture:SetHorizTile(horizTile) - Sets whether the widget should adjust horizontal texture coordinates based on texture and widget dimensions.
Texture:SetMask(maskName)
Texture:SetNonBlocking()
Texture:SetRotation(angle [, cx, cy]) - Applies a counter-clockwise rotation to the texture.
Texture:SetSnapToPixelGrid()
Texture:SetTexCoord(minX, maxX, minY, maxY or ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) - Modifies the region of a texture drawn by the Texture widget.
Texture:SetTexelSnappingBias(texelSnappingBias) where texelSnappingBias is [0-1]
Texture:SetTexture(file [, horizWrap, vertWrap, filterMode]) - Changes the texture displayed by the Texture widget.
Texture:SetVertexOffset(vertexIndex, offsetX, offsetY)
Texture:SetVertTile(horizTile) - Sets whether the widget should adjust vertical texture coordinates based on texture and widget dimensions.

Example

Creates a frame with CreateFrame() and then a texture with Frame:CreateTexture()

API CreateFrame mushroom

inv_mushroom_11

local f = CreateFrame("Frame", nil, UIParent)
f:SetPoint("CENTER")
f:SetSize(64, 64)

local tex = f:CreateTexture()
tex:SetAllPoints(f)
tex:SetTexture("interface/icons/inv_mushroom_11")

External links