Image Viewer

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

Moderators: cheriff, TyRaNiD

Post Reply
garich
Posts: 2
Joined: Sun Aug 14, 2005 2:03 am

Image Viewer

Post by garich »

Hi!

I will like to write a simple program: a image viewer.

The problem i have right now is that i do not know how i have to treat the images under C (i will like it to work, first, over JPG images) . I will like the program to read the images from a directory in the MS and show them, but i don´t know how to show a image ... can anyone help me? do you know of any existing code to do this?

Thanks!
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

You can use the loadImage function from graphics.c, but currently it supports png, only. With the other functions from graphics.c it would look like this (not tested, but should work) :

Code: Select all

initGraphics();
Image* image = loadImage("yourimage.png");
blitImageToScreen(0, 0, image->imageWidth, image->imageHeight, image, 0, 0);
flipScreen();
If you have changed the loadImage-function to load JPGs, let me know, then I can add it to my function, too.

Another idea is to use SDL. I'm sure there are some demo applications written in SDL, which are doing what you want, including perhaps image scaling and all kinds of graphics formats. Compiling SDL programs for PSP should be possible without much changes.
garich
Posts: 2
Joined: Sun Aug 14, 2005 2:03 am

Post by garich »

Sorry but .... what is SDL??

Thanks!
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

garich wrote:Sorry but .... what is SDL??
Google, first result: http://www.libsdl.org/

It is in the PSP svn repository and is already used for some programs from the pspware PSP svn repository.
Post Reply