Thread Tools Display Modes
02-20-24, 07:45 AM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Centering texture

Hello,
Since the widgets provided by the AceGUI library have their position locked, I rewrote the widget from scratch. In the final result, however, you notice that the lower and right sides of the background are less visible than the upper and left ones.
How can I make the four sides equal?




MWE:
Lua Code:
  1. local test = CreateFrame("Frame",nil,UIParent)
  2. local backdrop = {
  3.     bgFile = "Interface\\Buttons\\WHITE8X8",
  4.     edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5.     tile = true,
  6.     tileSize = 8,
  7.     edgeSize = 16,
  8.     insets = {
  9.         left = 3,
  10.         right = 3,
  11.         top = 3,
  12.         bottom = 3
  13.     },
  14.    
  15. }
  16. test:SetBackdrop(backdrop)
  17. test:SetBackdropColor(0, 0, 0, .95)
  18. test:SetSize(150,150)
  19. test:SetPoint("CENTER")
  20.  
  21. local colorPicker = CreateFrame("Button",nil,test)
  22. colorPicker:SetSize(24,24)
  23. colorPicker:SetPoint("CENTER")
  24.  
  25. colorPicker.colorSwatch = colorPicker:CreateTexture(nil, "OVERLAY")
  26. colorPicker.colorSwatch:SetWidth(19)
  27. colorPicker.colorSwatch:SetHeight(19)
  28. colorPicker.colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")
  29. colorPicker.colorSwatch:SetPoint("CENTER")
  30. colorPicker.colorSwatch:SetVertexColor(0, 0, 0)
  31.  
  32. colorPicker.texture = colorPicker:CreateTexture(nil, "BACKGROUND")
  33. colorPicker.texture:SetWidth(16)
  34. colorPicker.texture:SetHeight(16)
  35. colorPicker.texture:SetTexture(1, 1, 1)
  36. colorPicker.texture:SetPoint("CENTER", colorSwatch)
  37. colorPicker.texture:Show()
  38.  
  39. colorPicker.checkers = colorPicker:CreateTexture(nil, "BACKGROUND")
  40. colorPicker.checkers:SetWidth(14)
  41. colorPicker.checkers:SetHeight(14)
  42. colorPicker.checkers:SetTexture("Tileset\\Generic\\Checkers")
  43. colorPicker.checkers:SetTexCoord(.25, 0, 0.5, .25)
  44. colorPicker.checkers:SetDesaturated(true)
  45. colorPicker.checkers:SetVertexColor(1, 1, 1, 0.75)
  46. colorPicker.checkers:SetPoint("CENTER", colorSwatch)
  47. colorPicker.checkers:Show()
  Reply With Quote
02-20-24, 09:00 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
What version of the game is this for?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
02-20-24, 10:43 AM   #3
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Taken from this: https://github.com/nickbender/wow-in...olorPicker.lua
  Reply With Quote
02-20-24, 10:53 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Ahh, the code is from the WoD version of ElveUI.

Also, because the workings of the ColourPickerFrame changed in 10.2.5 and I don't believe the Classics have caught up with the changes yet.

From a best guess, I'd say the (presumably) Button frame in the centre of the image is using a standard Blizz. edgeFile for the backdrop that is designed to look like a 3D picture frame with a light shining down from the top left, casting a shadow on the bottom right.

You need to find a flat border edge file or go with something different (maybe just a flat outer texture and a second inner texture (swatch) to display the changing colours?)

Actually the texture use in the code ("Interface\\ChatFrame\\ChatFrameColorSwatch") is pretty flat and used by current Ace. See any addon that has a colour select option and uses Ace (eg. Mapster)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-20-24 at 11:58 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Centering texture


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off