Changes

Jump to navigation Jump to search

image.rotate

36 bytes removed, 22:19, 6 June 2012
Line 23: Line 23:  
== Example  ==
 
== Example  ==
 
<syntaxhighlight>local imw = earth:width()
 
<syntaxhighlight>local imw = earth:width()
    local imh = earth:height()
+
local imh = earth:height()
    local im = earth:copy(sc*imw, sc*imh)
+
local im = earth:copy(sc*imw, sc*imh)
    im = im:rotate(-tilt)
+
im = im:rotate(-tilt)
    local midx = im:width()/2 -- this is the important bit for having the right coordinates
+
local midx = im:width()/2 -- this is the important bit for having the right coordinates
    local midy = im:height()/2
+
local midy = im:height()/2
    local x = w/4 - midx
+
local x = w/4 - midx
    local y = h/2 - midy
+
local y = h/2 - midy
    gc:drawImage(im, x, y) -- we must be in a gc-passed function (like [[on.paint]](gc))
+
gc:drawImage(im, x, y) -- we must be in a gc-passed function (like [[on.paint]](gc))
    imw, imh = im:width(), im:height()</syntaxhighlight>
+
imw, imh = im:width(), im:height()</syntaxhighlight>
    
== Good to know ==
 
== Good to know ==

Navigation menu