Today I'm asking you for some help with SetTexCoord().
I'm trying to transform icon textures into a 'trapezoid' form. Unfortunately the results are somewhat unexpected.
Let's consider the following code:
Lua Code:
tFrame = CreateFrame("Frame", UIParent)
tFrame:SetPoint("CENTER", UIParent, "CENTER")
tFrame:SetHeight(100)
tFrame:SetWidth(100)
tFrame:Show()
tTex = tFrame:CreateTexture(nil,"OVERLAY")
tTex:SetTexture("Interface\\icons\\ability_ambush")
tTex:SetPoint("CENTER", tFrame, "CENTER")
tTex:SetTexCoord(0,0, -0.25,1, 1,0, 1.25, 1)
tTex:Show()
For your overview:
Texture coordinates are
ULx/y: 0/0 URx/y: 1/0
LLx/y: 0/1 LRx/y: 1/1
And the SetTexCoord parameters are ULx/y, LLx/y, URx/y, LRx/y
The result of the code above
should be like the one on the right side (I've made this one with Photoshop ... just to show what I'm expecting) in this image:
But the result
is like the left one. Almost like expected ... but somewhat 'distorted' in the lower left corner. :/
I can't see where this 'distortion' comes from. Does anyone has an idea?
btw: If you test my code above the actual result will be like this:
This
is as expected and is not related to my problem. I've replace the icon texture by a copy of it with a single transparent pixel at all borders. That's all.
Edit
Tried it with a more 'specific' texture. The left one is original, the right one is transformed. Weird.