All Texture objects now have texture:AddMaskTexture(mask) and texture:RemoveMaskTexture(mask) methods.
Moreover, texture:SetTexture(...) received some upgrades, 2nd and 3rd args can be used to set hWrapMode and vWrapMode.
Originally Posted by TheDanW
ls-: if you use a bool for the 2nd/3rd args then true is equivalent to "REPEAT" otherwise it defaults to "CLAMP"; there's 6 wrap modes that can be set as a string though
CLAMP, REPEAT, CLAMPTOBLACK, CLAMPTOBLACKADDITIVE, CLAMPTOWHITE, MIRROR
|
So that's what you wanna do:
Lua Code:
local mask = UIParent:CreateMaskTexture()
mask:SetTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
mask:SetSize(128, 128)
mask:SetPoint("CENTER")
local texture = UIParent:CreateTexture(nil, "ARTWORK")
texture:SetColorTexture(0, 1, 1)
texture:SetSize(128, 128)
texture:SetPoint("CENTER")
texture:AddMaskTexture(mask)
IIRC, each texture can have upto 3 masks applied.
Sadly, it can't be used w/ statusbar:GetStatusBarTexture(), that's kinda StatusBar bug, the only workaround is to make real status bar texture transparent and create your own texture to replace it.
There's some bugs w/ MaskTextures too, for instance, if you're using mask textures w/ SmoothStatusBar mixin or oUF_Smooth or any sort of status bar "smoothing" technique, it'll take some time till mask is reapplied. I already reported this bug w/ sample code and stuff... Dan said that he kinda found the reason why it's happening, so it should be fixed in next PTR build, probably, I'll ask him today...
Said bug in action o_O
There's a way to crash client by passing "bad" args to frame:CreateMaskTexture(...), but I also reported this issue.
And Infus reported some other bug, I don't remember what T_T