If the texture file you use has the border sections aligned and clustered correctly, it is actually pretty easy, something like the below code should do it.
Code:
local backdrop = {
bgFile = "Interface\\Buttons\\WHITE8X8",
-- use the correct path below, mind the double \\
edgeFile = "Interface\\AddOns\\MyMediaFolder\\MyBorderFile",
edgeSize = 8,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
}
self.CPoints = {}
self.CPoints.unit = PlayerFrame.unit
for i = 1, 5 do
self.CPoints[i] = CreateFrame("Frame", nil, self.Health)
self.CPoints[i]:SetHeight(18)
self.CPoints[i]:SetWidth(48)
-- the below line may be skipped, use only if cpoints are not visible
self.CPoints[i]:SetFrameLevel(self.Health:GetFrameLevel() + 1)
self.CPoints[i]:SetBackdrop(backdrop)
if i == 1 then
self.CPoints[i]:SetPoint("TOPLEFT", -80, 100)
self.CPoints[i]:SetBackdropColor(0.65, 0.63, 0.35)
else
self.CPoints[i]:SetPoint("TOP", self.CPoints[i-1], "BOTTOM", 1)
end
end
self.CPoints[2]:SetBackdropColor(0.65, 0.63, 0.35)
self.CPoints[3]:SetBackdropColor(0.65, 0.63, 0.35)
self.CPoints[4]:SetBackdropColor(0.74, 0.25, 0.25)
self.CPoints[5]:SetBackdropColor(0.45, 0.72, 0.45)
self:RegisterEvent("UNIT_COMBO_POINTS", UpdateCPoints)
end
Play around with the edgeSize and inset sizes to find a nice fit. However if your border file is neither segmented nor a uniform texture you can apply without rotation and clipping it is a pain in the ass you don't want to experience.
(That last 'end' closes a function preceding the code snippet you pasted.)