View Single Post
01-20-14, 12:32 AM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Thank you semlar. I've actually never heard of or used region:SetSize(). oO
That definitely helps a lot.

Today I came up with a complete different way to show undistorted textures of this shape. But be warned .... it's kind of a bad hack. If you are of a sensitive mind then you shouldn't read further.

Nevertheless ... here it is:
Lua Code:
  1. tFrame = CreateFrame("Frame", UIParent)
  2. tFrame:SetPoint("CENTER", UIParent, "CENTER")
  3. tFrame:SetHeight(200)
  4. tFrame:SetWidth(200)
  5. tFrame:Show()
  6. tTex = tFrame:CreateTexture("t0","OVERLAY")
  7. tTex:SetTexture("Interface\\icons\\ability_ambush")
  8. tTex:SetHeight(1)
  9. tTex:SetWidth(tFrame:GetWidth())
  10. tTex:SetPoint("TOP", tFrame, "TOP", 0, 0)
  11. tTex:SetTexCoord(0, 1, 0, 1 / tFrame:GetHeight())
  12. tTex:Show()    
  13. for x = 1, tFrame:GetHeight() do
  14.         tTex = tFrame:CreateTexture("t"..x,"OVERLAY")
  15.         tTex:SetTexture("Interface\\icons\\ability_ambush")
  16.         tTex:SetHeight(1)
  17.         tTex:SetWidth(tFrame:GetWidth())
  18.         tTex:SetPoint("TOP", _G["t"..(x - 1)], "BOTTOM")
  19.         tTex:SetTexCoord(-((1 / tFrame:GetHeight()) * x), 1 + (1 / tFrame:GetHeight()) * x, (1 / tFrame:GetHeight()) * x, ((1 / tFrame:GetHeight()) * x) + (1 / tFrame:GetHeight()))
  20.         tTex:Show()    
  21. end

It just comprises the full texture of a lot of single line textures. Should be easy to write a SetTexture wrapper function to set and handle those 'textures'.

Unfortunately it raises new problems. I'm rotating the parent frame of the textures, and as we know the animation thingi is a great mess. It can't handle textures that are not anchored to the center of the parent widget.

And yes, I know, creating 200 textures to show a single one is a big waste of ressources.

Last edited by Duugu : 01-20-14 at 12:41 AM.
  Reply With Quote