View Single Post
05-11-17, 12:51 AM   #12
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
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:
  1. local mask = UIParent:CreateMaskTexture()
  2. mask:SetTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
  3. mask:SetSize(128, 128)
  4. mask:SetPoint("CENTER")
  5.  
  6. local texture = UIParent:CreateTexture(nil, "ARTWORK")
  7. texture:SetColorTexture(0, 1, 1)
  8. texture:SetSize(128, 128)
  9. texture:SetPoint("CENTER")
  10. 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
__________________

Last edited by lightspark : 05-11-17 at 03:55 AM.
  Reply With Quote