So I keep search and I found something very interesting and it gives me an idea.
It's an AddOn called
EnhancedClassIconPortraits, and this is his core:
Lua Code:
local TEXTURE_NAME = "Interface\\AddOns\\EnhancedClassIconPortraits\\Textures\\%s.tga"
hooksecurefunc("UnitFramePortrait_Update", function(self)
if self.portrait then
if UnitIsPlayer(self.unit) then
local _, class = UnitClass(self.unit)
if class then
self.portrait:SetTexture(TEXTURE_NAME:format(class))
else
--[===[@alpha@
print(("EnhancedClassIconPortraits Error: UnitClass returned nil for unit %q"):format(self.unit))
--@end-alpha@]===]
end
end
end
end)
If I take a similar way as above, I can avoid to call
SetMask() and have the same result without performance issue. So I have extracted the textures and applied directly a mask on it. Now I have a folder with 46 icons,
here is an example. Maybe the name of the textures in the folder could need to be renamed if I want to call them.
That's probably less efficient than
SetAtlas(). What do you think about it? Is that possible?