Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Sets the vertex shading color of the region.

Region:SetVertexColor(colorR, colorG, colorB [, a])

Arguments[]

colorR
number [0.0 - 1.0] - Red component
colorG
number [0.0 - 1.0] - Green component
colorB
number [0.0 - 1.0] - Blue component
a
number? [0.0 - 1.0] = 1.0 - Alpha (opacity) of the texture

Example[]

Shows a plain texture and yellow vertexed texture.

API Region SetVertexColor 01
local f = CreateFrame("Frame", nil, UIParent)
f:SetPoint("CENTER")
f:SetSize(1, 1)

f.tex1 = f:CreateTexture()
f.tex1:SetPoint("CENTER")
f.tex1:SetSize(32, 32)
f.tex1:SetTexture("Interface/Tooltips/UI-Tooltip-Background")

f.tex2 = f:CreateTexture()
f.tex2:SetPoint("CENTER", 48, 0)
f.tex2:SetSize(32, 32)
f.tex2:SetTexture("Interface/Tooltips/UI-Tooltip-Background")
f.tex2:SetVertexColor(1, 1, 0)

Sets the vertex colors of the 9-slice regions.

API Region SetVertexColor 02
local f = CreateFrame("Frame", nil, nil, "BackdropTemplate")
f:SetPoint("CENTER")
f:SetSize(100, 50)
f:SetBackdrop(BACKDROP_TUTORIAL_16_16)

f.TopEdge:SetVertexColor(1, 0, 0)
f.LeftEdge:SetVertexColor(0, 1, 0)
f.TopLeftCorner:SetVertexColor(1, 1, 0)
f.TopRightCorner:SetVertexColor(0, 0, 1)

Details[]

It appears that the values specified are actually percentages to adjust the original color values (specified in the XML content) by.
For example, you have a background layer with a texture (named 'myModBackground') set as a filled color of (decimal RGB triplet) '0.5,0,0.5'.
You execute the following in one of your functions:
_G["myModBackground"]:SetVertexColor(0.5,1,0.5);
The result would be that the color for 'myModBackground' is set to (0.25,0,0.25), not (0.5,1,0.5).
The reason the method says "vertex color" is most likely due to the implementation details of how this works. OpenGL and Direct3D both support the concept of "vertex colors" which are frequently used in lighting. Each vertex of a 3-D object can have a "vertex color" set on it. The polygon will then be drawn with the vertex color shaded based on the location of the pixel relative to the vertexes of the polygon.
Presumably this method sets all four vertexes of the quad used to make up interface elements to the given color, creating a filtering effect. The color is a direct filtering effect. Each color component of the object will be multiplied by the value given to determine the final color.
So, setting (1.0, 1.0, 0.0) on a white object will color it yellow. But doing the same thing on a blue object will make it black. Be careful when using this on textured items.
Advertisement