类型 函数 对象 TextureResourceCanvas 库 graphics.* 修订版本 版本 2024.3703 另请参阅 TextureResource TextureResourceCanvas texture:invalidate()
此方法将一个 显示对象 添加/渲染到 TextureResourceCanvas 对象的内部渲染队列中。所有排队对象的渲染都在调用 texture:invalidate() 之后发生。
texture:draw( object )
DisplayObject. 要插入到渲染队列中的对象。
local tex = graphics.newTexture( { type="canvas", width=128, height=128 } ) -- Create a circle and draw/render it to the texture local circ = display.newCircle( 0, 0, 64 ) circ:setFillColor( { type="gradient", color1={0,0.2,1}, color2={0.8,0.8,0.8}, direction="down" } ) tex:draw( circ ) -- Schedule texture objects to be rendered to texture before next frame tex:invalidate()