WoW:API Texture SetDesaturated: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
({{widgetmethod}})
Line 1: Line 1:
{{widgetmethod}}
Sets a texture to be desaturated, to make it greyscale.
Sets a texture to be desaturated, to make it greyscale.


Line 31: Line 33:
  end
  end
  end
  end
----
{{template:WoW API}}

Revision as of 13:30, 10 June 2006

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

So far haven't gotten a return other than 1. Likely nil or false if desaturation isn't supported due to the user's graphic capabilities. (see below)


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