SetPortraitToTexture

From Warcraft Wiki
Jump to navigation Jump to search

Applies a circular mask to a texture, making it resemble a portrait.

SetPortraitToTexture(texture, path)

Arguments

texture
Texture🔗
path
string|number : fileID

Details

  • This function only accepts texture assets that have dimensions of 64x64 or smaller. Larger textures will raise an "Texture is not 64x64 pixels" error.
    • For larger textures, consider instead using MaskTexture objects which do not suffer from this same limitation.

Example

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

f.tex = f:CreateTexture()
f.tex:SetAllPoints(f)
SetPortraitToTexture(f.tex, "interface/icons/inv_mushroom_11")

API SetPortraitToTexture.png

Patch changes

Dragonflight Patch 10.2.0 (2023-11-07): The texture parameter must now be a texture object. Previously, it could be a string that named a global texture object.

See also