Hi
I'm in the process of creating a casting bar, and I'm currently working with the icon of the spell currently being cast.
The icon I plan to use is the one returned by UnitCastingInfo(). This icon however, is square with a border, I want a circular icon.
I have tried using SetPortraitToTexture() and it does indeed make it fit inside a circle, this however leaves some of the border present in the icon image still visible, so I thought, hey, let's crop these out using SetTexCoord()! This does remove the border, however, the image is no longer circular. This has the same effect no matter the call order of these two.
This is the relevant code (from my OnEvent handler)
Lua Code:
if event == "UNIT_SPELLCAST_START" then
local name, _, _, texture, startTime, endTime = UnitCastingInfo(this.unit)
if not name then
this.Hide()
return
end
SetPortraitToTexture(centerContentTexture, texture)
centerContentTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9)
this.casting = 1
this.startTime = startTime
this.endTime = endTime
this.Show()
end
An an example of what this looks like:
I don't know how to achieve what I want, a circular image where no pieces of the border are left. Any help is greatly appreciated =)
*EDIT*
So, 2 minutes after posting this, I realized that it was actually circular, my numbers in SetTexCoord() where just wrong. So it has now removed some of the border, while maintaining being circular. I can't get it perfect though, which is unfortunate, but this leaves me to think that I'm going about this the wrong way. Is there a way to crop the picture, and use this cropped instance with SetPortraitToTexture()?