Links |
---|
Changes the texture of a Texture widget.
texture:SetTexture(file [, horizWrap, vertWrap, filterMode])
Arguments
- file
- string|number - Path to a texture (usually in
Interface\\
) or a FileDataID. - horizWrap
- string? - How to sample texture coordinates beyond the (0, 1) range. Applies to both horizontal and vertical wrapping.
horizWrap Description "CLAMP" Default; extends the texture edges infinitely. "CLAMPTOBLACK" Fills the overflow with black. "CLAMPTOBLACKADDITIVE" Fills overflow with a transparent black. "CLAMPTOWHITE" Fills the overflow with white. "REPEAT" (or true
)Repeats the whole texture infinitely. "MIRROR" Repeats the whole texture infinitey, mirroring adjacent iterations.
- vertWrap
- string? - Unused argument. The horizWrap argument applies instead.
- filterMode
- string?
filterMode Description "LINEAR" Default; bilinear filtering. "TRILINEAR" Also sampling mipmaps. "NEAREST" Nearest-neighbor filtering.
Details
- There is a return value; however, it is always
true
and has no significance. - Pixels outside the texture coordinate space may be sampled explicitly by Texture:SetTexCoord(), or implicitly by the tiling mechanism when the texture widget is larger than the default size of the texture file.
- Custom images must be in BLP, JPEG, or TGA format with power-of-two dimensions (e.g. 16x16, 8x32, 256x64). TGA images may have 8bpp grayscale, 24bpp RGB, or 32 bpp RGBA; RLE is supported.
- The client only displays image files that existed when it launched, so adding new custom textures requires a restart.
- Textures load asynchronously. For example,
texture:GetSize()
returns 0,0 untiltexture:IsObjectLoaded()
becomestrue
; and then it returns the native texture size.
Patch changes
Patch 8.0.1 (2018-07-17): Added filterMode argument.
Patch 7.3.5 (2018-01-16): Changed horizWrap to apply horizontally and vertically, ignoring 'vertWrap (build 26972).
Patch 7.0.3 (2016-07-19): Solid-color variant replaced with Texture:SetColorTexture().
Patch 4.0.3a (2010-11-23): Changed the return value to always
true
; no longer indicating success.Patch 1.10.0 (2006-03-28): Added success return value.[1]
See also
- Texture:SetColorTexture(r, g, b [, a]) - Sets a solid-color texture.
- Texture:SetHorizTile(horizTile) - Whether to wrap a texture horizontally to match the widget width.
- Texture:SetVertTile(vertTile) - Whether to wrap a texture vertically to match the widget height.
References
- ^
slouken 2006-02-09. Re: Upcoming 1.10 Changes - Concise List. Archived from the original