Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
image.rotate
36 bytes removed
,
22:19, 6 June 2012
→Example
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 ==
Adriweb
Bureaucrats
,
Administrators
935
edits
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version