copy an area of the screen or image?
Moderators: Shine, Insert_witty_name
-
- Posts: 31
- Joined: Sat Mar 04, 2006 1:35 am
copy an area of the screen or image?
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.
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.
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.