Difference between revisions of "Canvas:newImageData"
m |
m (CanvasMipmapMode -> MipmapMode) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 14: | Line 14: | ||
== Function == | == Function == | ||
+ | {{newin|[[11.0]]|110|type=variant}} | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | data = Canvas:newImageData( slice, mipmap, x, y, width, height ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|number|slice|The cubemap face index, array index, or depth layer for [[TextureType|cubemap, array, or volume]] type Canvases, respectively. This argument is ignored for regular 2D canvases.}} | ||
+ | {{param|number|mipmap (1)|The mipmap index to use, for Canvases with [[MipmapMode|mipmaps]].}} | ||
+ | {{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 (in pixels) 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 in pixels of the area within the Canvas to capture.}} | ||
+ | === Returns === | ||
+ | {{param|ImageData|data|The new ImageData made from the Canvas' contents.}} | ||
+ | |||
+ | == Function == | ||
+ | {{oldin|[[11.0]]|110|type=variant}} | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 19: | Line 36: | ||
</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.}} | ||
Line 28: | Line 45: | ||
== See Also == | == See Also == | ||
* [[parent::Canvas]] | * [[parent::Canvas]] | ||
− | * [[love.graphics. | + | * [[love.graphics.captureScreenshot]] |
* [[Constructs::ImageData]] | * [[Constructs::ImageData]] | ||
[[Category:Functions]] | [[Category:Functions]] |
Latest revision as of 14:57, 29 July 2020
Available since LÖVE 0.10.0 |
It has been renamed from Canvas:getImageData. |
Generates ImageData from the contents of the Canvas.
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! |
Contents
Function
Synopsis
data = Canvas:newImageData( )
Arguments
None.
Returns
ImageData data
- The new ImageData made from the Canvas' contents.
Function
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Synopsis
data = Canvas:newImageData( slice, mipmap, x, y, width, height )
Arguments
number slice
- The cubemap face index, array index, or depth layer for cubemap, array, or volume type Canvases, respectively. This argument is ignored for regular 2D canvases.
number mipmap (1)
- The mipmap index to use, for Canvases with mipmaps.
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.
Function
Removed in LÖVE 11.0 |
This variant is not supported in that and later versions. |
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
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info