WoW:API Texture SetDesaturated: Difference between revisions
Jump to navigation
Jump to search
({{widgetmethod}}) |
m (Move page script moved page API Texture SetDesaturated to API Texture SetDesaturated without leaving a redirect) |
||
(One intermediate revision by one other user not shown) | |||
Line 16: | Line 16: | ||
; shaderSupported | ; shaderSupported | ||
returns nil if desaturation isn't supported by the user's graphics card (ie. old GeForce4 cards don't). One can use texture:SetVertexColor instead in this case. See the example below for the way Blizzard handles this. | |||
---- | ---- |
Latest revision as of 04:47, 15 August 2023
← Widget API ← Texture < SetDesaturated
Sets a texture to be desaturated, to make it greyscale.
shaderSupported = texture:SetDesaturated(desaturation);
- Arguments
- desaturation
nil = normal colors
1 = desaturate (greyscale)
- Returns
- shaderSupported
returns nil if desaturation isn't supported by the user's graphics card (ie. old GeForce4 cards don't). One can use texture:SetVertexColor instead in this case. See the example below for the way Blizzard handles this.
There is a wrapper function in UIParent.lua that appears to darken the texture if shaderSupported returns false:
-- Wrapper for the desaturation function function SetDesaturation(texture, desaturation) local shaderSupported = texture:SetDesaturated(desaturation); if ( not shaderSupported ) then if ( desaturation ) then texture:SetVertexColor(0.5, 0.5, 0.5); else texture:SetVertexColor(1.0, 1.0, 1.0); end end end