Difference between revisions of "(Image):refresh"
m (Shortened description) |
m (Fix missing removal notice) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{newinoldin|[[0.9.0]]|090|[[11.0]]|110|type=function|text=It has been replaced by [[(Image):replacePixels|Image:replacePixels]]}} |
Reloads the Image's contents from the [[ImageData]] or [[CompressedData]] used to create the image. | Reloads the Image's contents from the [[ImageData]] or [[CompressedData]] used to create the image. | ||
== Function == | == Function == | ||
Line 8: | Line 8: | ||
=== Arguments === | === Arguments === | ||
None. | None. | ||
+ | === Returns === | ||
+ | Nothing. | ||
+ | |||
+ | == Function == | ||
+ | {{newinoldin|[[0.10.0]]|100|[[11.0]]|110|type=variant|text=It has been replaced by [[(Image):replacePixels|Image:replacePixels]]}} | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | Image:refresh( x, y, width, height ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|number|x|The x-axis of the top-left corner of the area within the Image to reload.}} | ||
+ | {{param|number|y|The y-axis of the top-left corner of the area within the Image to reload.}} | ||
+ | {{param|number|width|The width of the area within the Image to reload.}} | ||
+ | {{param|number|height|The height of the area within the Image to reload.}} | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
== Examples == | == Examples == | ||
− | |||
<source lang="lua"> | <source lang="lua"> | ||
function love.load() | function love.load() | ||
− | + | imagedata = love.image.newImageData("pig.png") | |
+ | image = love.graphics.newImage(imagedata) | ||
end | end | ||
Line 23: | Line 37: | ||
function love.keypressed(key) | function love.keypressed(key) | ||
− | + | if key == "e" then | |
− | + | -- Modify the original ImageData and apply the changes to the Image. | |
− | if key == "e" | + | imagedata:mapPixel(function(x, y, r, g, b, a) return r/2, g/2, b/2, a/2 end) |
− | |||
− | |||
image:refresh() | image:refresh() | ||
end | end | ||
Line 37: | Line 49: | ||
* [[(Image):getData|Image:getData]] | * [[(Image):getData|Image:getData]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description=Reloads the Image's contents from the | + | {{#set:Description=Reloads the Image's contents from the ImageData or CompressedData used to create the image.}} |
== Other Languages == | == Other Languages == | ||
{{i18n|(Image):refresh}} | {{i18n|(Image):refresh}} |
Latest revision as of 22:21, 10 July 2018
Available since LÖVE 0.9.0 and removed in LÖVE 11.0 |
It has been replaced by Image:replacePixels. |
Reloads the Image's contents from the ImageData or CompressedData used to create the image.
Contents
Function
Synopsis
Image:refresh( )
Arguments
None.
Returns
Nothing.
Function
Available since LÖVE 0.10.0 and removed in LÖVE 11.0 |
It has been replaced by Image:replacePixels. |
Synopsis
Image:refresh( x, y, width, height )
Arguments
number x
- The x-axis of the top-left corner of the area within the Image to reload.
number y
- The y-axis of the top-left corner of the area within the Image to reload.
number width
- The width of the area within the Image to reload.
number height
- The height of the area within the Image to reload.
Returns
Nothing.
Examples
function love.load()
imagedata = love.image.newImageData("pig.png")
image = love.graphics.newImage(imagedata)
end
function love.draw()
love.graphics.draw(image)
end
function love.keypressed(key)
if key == "e" then
-- Modify the original ImageData and apply the changes to the Image.
imagedata:mapPixel(function(x, y, r, g, b, a) return r/2, g/2, b/2, a/2 end)
image:refresh()
end
end
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