Line 3: |
Line 3: |
| | | |
| | | |
− | Returns a copy of the input image rotated counterclockwise by the amount of degrees given. | + | Returns a copy of the input image rotated counterclockwise by the amount of degrees given.<br /> |
| + | <br /> |
| | | |
| {{Since|3.2}} | | {{Since|3.2}} |
Line 21: |
Line 22: |
| | | |
| == Example == | | == Example == |
− | <syntaxhighlight>local imw = earth:width() | + | <syntaxhighlight>local sc = 0.15 |
− | local imh = earth:height()
| + | local imw = earth:width() |
− | local im = earth:copy(sc*imw, sc*imh)
| + | local imh = earth:height() |
− | im = im:rotate(-tilt)
| + | local im = earth:copy(sc*imw, sc*imh) |
− | local midx = im:width()/2 -- this is the important bit for having the right coordinates
| + | im = im:rotate(-tilt) |
− | local midy = im:height()/2
| + | local midx = im:width()/2 -- this is the important bit for having the right coordinates |
− | local x = w/4 - midx
| + | local midy = im:height()/2 |
− | local y = h/2 - midy
| + | local x = w/4 - midx |
− | gc:drawImage(im, x, y) -- we must be in a gc-passed function (like [[on.paint]](gc))
| + | local y = h/2 - midy |
− | imw, imh = im:width(), im:height()</syntaxhighlight>
| + | gc:drawImage(im, x, y) -- we must be in a gc-passed function (like on.paint(gc)) |
| + | imw, imh = im:width(), im:height()</syntaxhighlight> |
| | | |
| == Good to know == | | == Good to know == |