Type Function Object TextureResourceCanvas Library graphics.* Revision 2017.3060 See also TextureResource TextureResourceCanvas texture:invalidate()
Sets the fill color of the texture, also known as the "clear color" or the background. The entire texture will be set to the specified color during the next scheduled
texture:setBackground( gray ) texture:setBackground( gray, alpha ) texture:setBackground( red, green, blue ) texture:setBackground( red, green, blue, alpha )
Numbers. Numbers between 0
and 1
that represent the corresponding value for that channel. alpha
represents the opacity of the texture without anything rendered to it.
local tex = graphics.newTexture( { type="canvas", width=128, height=128 } ) -- Set texture background to magenta tex:setBackground( 1, 0, 1 ) tex:invalidate()