Difference between revisions of "love.graphics.newCanvas"

m (Notes)
m
Line 28: Line 28:
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
canvas = love.graphics.newCanvas( width, height, texture_type )
+
canvas = love.graphics.newCanvas( width, height, format )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 
{{param|number|width (window_width)|The desired width of the Canvas.}}
 
{{param|number|width (window_width)|The desired width of the Canvas.}}
 
{{param|number|height (window_height)|The desired height of the Canvas.}}
 
{{param|number|height (window_height)|The desired height of the Canvas.}}
{{param|TextureMode|texture_type ("normal")|The desired texture mode of the Canvas.}}
+
{{param|TextureFormat|format ("normal")|The desired texture format of the Canvas.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|Canvas|canvas|A new Canvas with specified width and height.}}
 
{{param|Canvas|canvas|A new Canvas with specified width and height.}}
Line 43: Line 43:
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
canvas = love.graphics.newCanvas( width, height, texture_type, fsaa )
+
canvas = love.graphics.newCanvas( width, height, format, fsaa )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 
{{param|number|width (window_width)|The desired width of the Canvas.}}
 
{{param|number|width (window_width)|The desired width of the Canvas.}}
 
{{param|number|height (window_height)|The desired height of the Canvas.}}
 
{{param|number|height (window_height)|The desired height of the Canvas.}}
{{param|TextureMode|texture_type ("normal")|The desired texture mode of the Canvas.}}
+
{{param|Format|format ("normal")|The desired texture format of the Canvas.}}
 
{{param|number|fsaa (0)|The desired number of antialiasing samples used when drawing to the Canvas.}}
 
{{param|number|fsaa (0)|The desired number of antialiasing samples used when drawing to the Canvas.}}
 
=== Returns ===
 
=== Returns ===

Revision as of 21:59, 5 February 2014

Available since LÖVE 0.8.0
It has been renamed from love.graphics.newFramebuffer.

Creates a new Canvas object for offscreen rendering.

O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!  



Function

Synopsis

canvas = love.graphics.newCanvas( )

Arguments

None.

Returns

Canvas canvas
A new Canvas with width/height equal to the window width/height.

Function

Synopsis

canvas = love.graphics.newCanvas( width, height )

Arguments

number width
The desired width of the Canvas.
number height
The desired height of the Canvas.

Returns

Canvas canvas
A new Canvas with specified width and height.

Function

Available since LÖVE 0.9.0
This variant is not supported in earlier versions.

Synopsis

canvas = love.graphics.newCanvas( width, height, format )

Arguments

number width (window_width)
The desired width of the Canvas.
number height (window_height)
The desired height of the Canvas.
TextureFormat format ("normal")
The desired texture format of the Canvas.

Returns

Canvas canvas
A new Canvas with specified width and height.

Notes

Some Canvas texture modes have higher system requirements than normal Canvases. Use love.graphics.isSupported to check for support.

Function

Available since LÖVE 0.9.1
This variant is not supported in earlier versions.

Synopsis

canvas = love.graphics.newCanvas( width, height, format, fsaa )

Arguments

number width (window_width)
The desired width of the Canvas.
number height (window_height)
The desired height of the Canvas.
Format format ("normal")
The desired texture format of the Canvas.
number fsaa (0)
The desired number of antialiasing samples used when drawing to the Canvas.

Returns

Canvas canvas
A new Canvas with specified width and height.

Notes

Antialiased Canvases have *slightly* higher system requirements than normal Canvases. Additionally, the supported maximum number of fsaa samples varies depending on the system. Use love.graphics.getSystemLimit to check.

If the number of FSAA samples specified is greater than the maximum supported by the system, the Canvas will still be created but only using the maximum supported amount (this includes 0.)

See Also


Other Languages