Quantcast WoWInterface - View Single Post - Customising Stuf
View Single Post
05-23-11, 06:59 PM   #3
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Creating Pixel Perfect Borders and any Unit Frame Element.

Warning: This modification only works to make pixel perfect borders around Stuf UF elements, if you wish to use any other border then they wont work and I suggest you dont follow this part of the guide.

There has been previous guides/posts on how to do this, but this only works with status bars created with stuf, but doesn't work with things like text boxes and portraits,
this link has this method and is pretty straight forward to do. All it takes is to copy and paste a section of code into Stuf\core.lua.


However my mod makes pixel perfect borders on every element possible.
Check the differences in the attached images, img3 shows the default square border around a portrait, whereas img4 shows my new and improved pixel border.

So lets begin, again open Stuf\core.lua into your editor.

The first change is to add a line, near the top of the file you will see something along the line of:
-- LibSharedMedia-3.0 register media files
And underneath it a block of text, this block of text is the method used by Stuf to register its artworks including Status Bar Texture, Fonts and Borders.
As its a border we're adding this is where we'll register it for use in Stuf.
So at the bottom of this block of text add the following line.
smed:Register("border", "Pixel Border", "Interface\\ChatFrame\\ChatFrameBackground")
You could try reloading WoW now and checking to see if it added a new border(after saving the file), but if you use it, you would and up with a fat border around anything you use it on, the next steps will change it to a pixel border.

Now scroll down the file a bit further and you should see the following line(dont scroll to far though as you may miss it)
-- fast access local variables
and just under that you'll see the following line:
local backdrop, borderdrop = { }, { edgeSize = 16, }
Now the part we're interested in is { edgeSize = 16, } this sets the size for all borders within Stuf, as you can see its set to a size of 16, just change this to a 1 and now we have pixel perfect borders.
Go ahead and try it. See we have those borders we always wanted, see img5, but wait theres a problem, we now have a gap between the element and the border.

Its ok, I have fix for that.

Now do a search for:
f.border:SetPoint("TOPLEFT", -4, 4)
This line and the following one, set the location of the border in relation to the elements.

In the first line the border is anchored to the TOPLEFT of the element and is set to be 4 pixels to the left and 4 pixels up, so all we have to do is change the 4's for 1's, but remember to leave the minus signs there.

So now save the file and reload.

In Stuf, just change to border to your elements to 'Pixel Border' and change to color/alpha to black and full opacity, and there we go, pixel perfect borders on any Stuf elements.

Thats all for this section.

Attached Images
  Reply With Quote