Pelles C forum

C language => Tips & tricks => Topic started by: TBD on February 13, 2005, 03:05:57 PM

Title: [source] Loading images using different techniques
Post by: TBD on February 13, 2005, 03:05:57 PM
http://www.rsdn.ru/article/qna/gdi/drawimg.xml

even if it is in russian and C++ code, you can find different techniques to load images (JPEG/GIF/PNG/...) using libraries already on the system (OleLoadPicture,GDI+,IImgCtx,DirectXTransform,Direct3D,...)

enjoy  :lol:
Title: [source] Loading images using different techniques
Post by: Vortex on February 13, 2005, 05:44:03 PM
Hi TBD,

Thanks for the link. It would be good to have a translation to english.

I have a little project to display BMPs from files:

http://smorgasbordet.com/phpBB2/viewtopic.php?t=260
Title: [source] Loading images using different techniques
Post by: TBD on February 13, 2005, 05:52:27 PM
heya Vortex,
I know the display BMPs from files example =D>

I am interested in displaying embedded PNG images, so I am looking for a solution without the need of external libraries in my exe. now I am using PNGLib (http://www.madwizard.org/view.php?page=downloads)

you can use an online translation service, for example check this translation (http://babelfish.altavista.com/babelfish/urltrurl?lp=ru_en&url=http://www.rsdn.ru/article/qna/gdi/drawimg.xml)

it would be nice to have the example translated to PellesC  :roll:
Title: [source] Loading images using different techniques
Post by: Pelle on February 13, 2005, 09:34:04 PM
The attached file should work - it uses the IImgCtx interface (from mshtml.dll). It will display images using an URL, so local files or web files will both work. If this works for you too, I will add it as a sample to the source code section...

Pelle
Title: [source] Loading images using different techniques
Post by: TBD on February 13, 2005, 09:46:12 PM
thanks Pelle !

you should add this to remove the flicker on resize:
Code: [Select]

case WM_ERASEBKGND:
 return 1;


it is possible to use relative paths instead of fixed ? I tried with file://./test.png and doesn't work (I have the test.png in .exe dir  :lol: )

... now I must found the way to load the image from memory instead of URL   :roll:
Title: [source] Loading images using different techniques
Post by: Pelle on February 13, 2005, 09:54:29 PM
Quote from: "TBD"
you should add this to remove the flicker on resize:
Code: [Select]

case WM_ERASEBKGND:
 return 1;


a) it's a sample
b) the text output will look terrible...

Quote from: "TBD"

it is possible to use relative paths instead of fixed ? I tried with file://./test.png and doesn't work (I have the test.png in .exe dir  :lol: )

Not a clue - I have very little information about limitations, requirements, supported formats...

Pelle
Title: [source] Loading images using different techniques
Post by: Vortex on March 03, 2005, 01:30:17 PM
Here is a tiny example using Ernest Murphy's image library. It can handle JPG, BMP, GIF and WMF images.
Title: [source] Loading images using different techniques
Post by: Vortex on March 03, 2005, 05:44:39 PM
Hi friends,

There was a local bug in Ernest Murphy's image displaying function BitmapFromFile.asm

Thanks to El_Choni for discovering and fixing this bug:

http://board.win32asmcommunity.net/viewtopic.php?t=10650

f0dder suggested fixing another bug found in BitmapFromMemory.asm

http://board.win32asmcommunity.net/viewtopic.php?p=145356#145356

This second improved version uses the BitmapFromFile.asm function simplifying the job.