Type Function Object TextureResourceCanvas Library graphics.* Revision 2017.3060 See also TextureResource TextureResourceCanvas texture:invalidate()
This method adds/renders a display object to the internal rendering queue of the TextureResourceCanvas object. All rendering of queued objects occurs after calling texture:invalidate().
Inserting a display object into the rendering queue also removes the object from its current group or the stage, since objects cannot exist in multiple groups.
texture:draw( object )
DisplayObject. The object to be inserted into the rendering queue.
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()