Code: Select all
function rotateImage(theImage)
newImage = Image.createEmpty(theImage:height(), theImage:width())
for x = 1, theImage:width() do
for y = 1, theImage:height() do
newImage:blit(y, x, theImage, x, y, 1, 1)
end
end
return newImage
end -- rotateImage
function scaleImage(newX, newY, theImage)
newImage = Image.createEmpty(newX, newY)
for x = 1, newX do
for y = 1, newY do
newImage:blit(x,y , theImage, math.floor(x*(theImage:width()/newX)),math.floor(y*(theI mage:height()/newY)), 1, 1)
end
end
return newImage
end --scaleImage
--main program
smile = Image.load("smiley.png")
screen:blit(0, 0, smile)
screen:blit(100, 0, rotateImage(smile))
screen:blit(0,100, scaleImage(100,150, smile))
screen:flip()
screen.waitVblankStart(600)