copy an area of the screen or image?

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
matriculated
Posts: 31
Joined: Sat Mar 04, 2006 1:35 am

copy an area of the screen or image?

Post by matriculated »

Well, due to the overwhelming response to my last question (http://forums.ps2dev.org/viewtopic.php? ... 6fd12daa05) I 've another one for you guys. Is it possible to copy a section of the screen or an image to memory instead of saving the entire screen to the memory stick? I'm writting a menuing system and this would be a great time saver.
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

Hmm....
Here, its a bit tricky.
-Make a new, blank image the size you want to save
-Then, blit the image that you want at negative coordinates...
Example:
Image is 480x272, you want 50x50 starting at 10x10:
(largeimage is the source image)

someimage = Image.createEmpty(50,50)
someimage:blit(-10, -10, largeimage)
someimage:save("image.png")

So there it is. Took me a while to make sure its -10,-10 instead of -9,-9 or -11,-11 because pixels start at 0.
Post Reply