类型 函数 对象 TextureResourceCanvas 库 graphics.* 改订版 2024.3703 版 另请参阅 TextureResource TextureResourceCanvas texture:invalidate()
它设置纹理的填充颜色,也称为“清除颜色”或背景。整个纹理将在下一次计划的
texture:setBackground( gray ) texture:setBackground( gray, alpha ) texture:setBackground( red, green, blue ) texture:setBackground( red, green, blue, alpha )
数字。 表示该通道对应值的 0
到 1
之间的数字。alpha
表示尚未渲染任何内容时的纹理不透明度。
local tex = graphics.newTexture( { type="canvas", width=128, height=128 } ) -- Set texture background to magenta tex:setBackground( 1, 0, 1 ) tex:invalidate()