Difference between revisions of "(Image):refresh"
m (Shortened description) |
(Edited example to involve less unnecessary concepts) |
||
Line 12: | Line 12: | ||
== 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 23: | ||
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 |
Revision as of 01:25, 13 August 2013
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Reloads the Image's contents from the ImageData or CompressedData used to create the image.
Function
Synopsis
Image:refresh( )
Arguments
None.
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