For a long time I've used the standard save screen function floating about:
Code: Select all
void saveScreen() {
int posX;
int posY;
Color pixel;
Color* vram = getVramDisplayBuffer();
Image* screenShot;
screenShot = createImage(480,272);
for (posY=0; posY<272; posY++) {
for(posX=0; posX<480; posX++) {
pixel = vram[PSP_LINE_SIZE * posY + posX];
putPixelImage(pixel,posX,posY,screenShot);
}}
saveImage("ms0:/Snapshot.png",screenShot->data,480,272,PSP_LINE_SIZE,0);
freeImage(screenShot);
}
Definitions of the args given in graphics.c for saveImage are rather ambiguous.
... particularly the difference between the logical and physical width./**
* Save an image or the screen in PNG format.
*
* @pre filename != NULL
* @param filename - filename of the PNG image
* @param data - start of Color type pixel data (can be getVramDisplayBuffer())
* @param width - logical width of the image or SCREEN_WIDTH
* @param height - height of the image or SCREEN_HEIGHT
* @param lineSize - physical width of the image or PSP_LINE_SIZE
* @param saveAlpha - if 0, image is saved without alpha channel
*/
extern void saveImage(const char* filename, Color* data, int width, int height, int lineSize, int saveAlpha);
Say I want to save a 134x76 icon0 sized image with alpha that is already declared,
loaded, and named ICON0 in RAM.
Code: Select all
saveImage("ms0:/ICON0.png",ICON0->data,134,74,?,1);
Cheers, Art.