Wowpedia
Advertisement
Wowpedia
240,425
pages

Texture (inherits from LayeredRegion, created with Frame:CreateTexture) displays a color block, a gradient, or a graphic raster taken from a .tga, .blp or .jpg file.

As a kind of LayeredRegion, Texture is always inside a layer within a Frame (or any type inheriting from Frame). In Lua the layer is an argument to CreateTexture(), and in XML <Layers> and <Layer> tags surround <Texture>.

Defined Methods

Most methods relate to setting appearance or source information.

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)

Examples

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")

Creates the same texture with <Texture>

<Frame parent="UIParent">
	<Layers>
		<Layer level="ARTWORK">
			<Texture file="interface/icons/inv_mushroom_11">
				<Anchors>
					<Anchor point="TOPLEFT" />
					<Anchor point="BOTTOMRIGHT" />
				</Anchors>
			</Texture>
		</Layer>
	</Layers>
	<Size><AbsDimension x="64" y="64" /></Size>
	<Anchors><Anchor point="CENTER" /></Anchors>
</Frame>

External links

Advertisement