UIOBJECT Texture

From Wowpedia
Jump to: navigation, search

Texture (inherits from LayeredRegion, created with Frame:CreateTexture) 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:GetAtlas()
Texture:GetBlendMode() - Returns the AlphaMode.
Texture:GetDesaturation()
Texture:GetHorizTile()
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: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: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.

Texture Masks

Texture:AddMaskTexture(maskTexture)
Texture:GetMaskTexture(index)
Texture:RemoveMaskTexture(maskTexture)
Texture:SetMask(maskName)

Example

Creates a texture with Frame:CreateTexture()

API CreateFrame mushroom.png

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