How to take a screenshot?Please help

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

How to take a screenshot?Please help

Post by gambiting »

Hi! Could anyone help me on how to make a screenshot inside my own app?I know I can do this using psplink or other software,but I would like to have this functionality built in.Please tell me what code and libriary should I use to be able to make a screenshot and save it as bmp or png.Thanks!
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Hi,
Obviously you need to include the png and graphics libs.
then this function that came from some sample, or somewhere else
here on ps2dev.org:

Code: Select all

void saveScreen() {
			int posX;
			int posY;
			Color pixel;
			Color* vram = getVramDisplayBuffer();
			Image* screenShot;
			screenShot = createImage(480,272);
			for &#40;posY=0; posY<272; posY++&#41; &#123;
			for&#40;posX=0; posX<480; posX++&#41; &#123;
			pixel = vram&#91;PSP_LINE_SIZE * posY + posX&#93;;
			putPixelImage&#40;pixel,posX,posY,screenShot&#41;;
			&#125;
			&#125;
			saveImage&#40;"ms0&#58;/Snapshot.png",screenShot->data,480,272,PSP_LINE_SIZE,0&#41;;
			freeImage&#40;screenShot&#41;;
&#125;
Cheers, Art.
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

Post by gambiting »

Thanks,it works,you helped me a lot :D
Post Reply