Difference between revisions of "Canvas:newImageData"

m
m
Line 19: Line 19:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|x|The x-axis of the top-left corner of the area within the Canvas to capture.}}
+
{{param|number|x|The x-axis of the top-left corner (in pixels) of the area within the Canvas to capture.}}
{{param|number|y|The y-axis of the top-left corner of the area within the Canvas to capture.}}
+
{{param|number|y|The y-axis of the top-left corner (in pixels) of the area within the Canvas to capture.}}
{{param|number|width|The width of the area within the Canvas to capture.}}
+
{{param|number|width|The width in pixels of the area within the Canvas to capture.}}
{{param|number|height|The height of the area within the Canvas to capture.}}
+
{{param|number|height|The height in pixels of the area within the Canvas to capture.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|ImageData|data|The new ImageData made from the Canvas' contents.}}
 
{{param|ImageData|data|The new ImageData made from the Canvas' contents.}}

Revision as of 16:49, 21 January 2018

Available since LÖVE 0.10.0
It has been renamed from Canvas:getImageData.

Generates ImageData from the contents of the Canvas.


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

data = Canvas:newImageData( )

Arguments

None.

Returns

ImageData data
The new ImageData made from the Canvas' contents.

Function

Synopsis

data = Canvas:newImageData( x, y, width, height )

Arguments

number x
The x-axis of the top-left corner (in pixels) of the area within the Canvas to capture.
number y
The y-axis of the top-left corner (in pixels) of the area within the Canvas to capture.
number width
The width in pixels of the area within the Canvas to capture.
number height
The height in pixels of the area within the Canvas to capture.

Returns

ImageData data
The new ImageData made from the Canvas' contents.

See Also

Other Languages