Jump to content
  • Advertisement
Sign in to follow this  
RomanH

showing JPEGs, PNGs and GIFs (WinAPI noob!)

This topic is 4159 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I've programmed quite a number of things with SDL. Now I would like to learn some more about the WinAPI. What keywords should I google if I wanted to program a simple picture viewer (as a first step) that displays JPEGs, PNGs and GIFs? Is it possible to do that in "pure" WinAPI (maybe even without DirectX)? Or are there any open/free libraries I could use? (except SDL/SDL_image) thanks! RomanH

Share this post


Link to post
Share on other sites
Advertisement
I guess this could be something interesting for you:

DevIL - OpenIL

Quote from website:

Quote:

Currently, DevIL can load .bmp, .cut, .dds, .doom, .gif, .ico, .jpg, .lbm, .mdl, .mng, .pal, .pbm, .pcd, .pcx, .pgm, .pic, .png, .ppm, .psd, .psp, .raw, .sgi, .tga and .tif .hdr files.
Formats supported for saving include .bmp, .dds, .h, .jpg, .pal, .pbm, .pcx, .hdr, .pgm,.png, .ppm, .raw, .sgi, .tga and .tif.

DevIL currently supports the following APIs for display: OpenGL, Windows GDI, SDL, DirectX and Allegro. Compilers that can compile DevIL or use it include Djgpp, MSVC++, Linux gcc, Delphi, Visual Basic, Power Basic and Dev-C++.

Share this post


Link to post
Share on other sites
Vanilla GDI has no functions for loading images from disk. It does have functions to load images from resource files (LoadImage). To load images not found in resources, you must write the loader yourself. The structure of a BMP file is:

BITMAPFILEHEADER
BITMAPINFOHEADER or BITMAPV4HEADER or BITMAPV5HEADER
array of RGBQUAD
image data

You must load these structures from the file, and create Bitmap objects from them. It's not an easy or short task to load image files in GDI. GDI+ and DirectX have library functions to load more file types with much less code. From Win98 onwards, GDI supported PNG and JPEG. Here is an MSDN article about GDI bitmaps and how to load them.

It'll be far easier to use a 3rd party library like the one mentioned above.

Skizz

Share this post


Link to post
Share on other sites
Thanks for the info. I've taken a look at DevIL and it looks like it's exactly what I need.

Thanks!

RomanH

Share this post


Link to post
Share on other sites
Quote:
Original post by Skizz
Vanilla GDI has no functions for loading images from disk. It does have functions to load images from resource files (LoadImage).


A bit of a contradiction here because LoadImage can load images from a file. GDI+ is definitely more flexible though :)

Share this post


Link to post
Share on other sites
Hi!

thanks for trying to help. In the meantime I have experimented with the FreeImage library a little and had some first successes. I'm now able to display tons of different formats in a window.

Free Image Hosting at www.ImageShack.us

thanks!

RomanH

Share this post


Link to post
Share on other sites
Quote:
Original post by JY
Quote:
Original post by Skizz
Vanilla GDI has no functions for loading images from disk. It does have functions to load images from resource files (LoadImage).


A bit of a contradiction here because LoadImage can load images from a file. GDI+ is definitely more flexible though :)

You learn something new everyday.

Skizz

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!