Difference between revisions of "(Image):refresh"
(Created page) |
m (Shortened description) |
||
Line 37: | Line 37: | ||
* [[(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 Data used to create the image.}} |
== Other Languages == | == Other Languages == | ||
{{i18n|(Image):refresh}} | {{i18n|(Image):refresh}} |
Revision as of 00:58, 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
Edit the Image's ImageData and refresh the Image using the edited ImageData.
function love.load()
image = love.graphics.newImage("pig.png")
end
function love.draw()
love.graphics.draw(image)
end
function love.keypressed(key)
-- If the image is compressed, it will return CompressedData which doesn't have a mapPixel method.
-- Currently only dds files can become compressed images.
if key == "e" and not image:isCompressed() then
local data = image:getData()
data: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