Loading bmp's without using windows programming?
Is there any way of loading bmp''s without using windows programming becasue trying to include a bmp in windows programming is just a pain in the neck having to create the image dc etc.
You can load any image once you know the file format. Go to www.wotsit.org, I suppose they have the BMP file format description.
Hint : If you have the choice, you may use TGA. They''re a bit easier to load and can handle 32 bits images.
Hint : If you have the choice, you may use TGA. They''re a bit easier to load and can handle 32 bits images.
LOL that is cool...i just finished writing a tutorial that deals with how to load/save bmps 10 minutes ago.
You can read it here http://www.runicsoft.com/bmp.php
But i have to warn you: loading them directly is way more complicated then using window''s LoadImage to bring them on a DC
------------
Runicsoft
You can read it here http://www.runicsoft.com/bmp.php
But i have to warn you: loading them directly is way more complicated then using window''s LoadImage to bring them on a DC
------------
Runicsoft
August 31, 2002 12:27 PM
Loading an image in windows (bmp) is quite easy. Try this:
HBITMAP l_hBMP=(HBITMAP)LoadImage(GetModuleHandle(0),"yourbitmap.bmp",IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
BITMAP l_BMP;
if (l_hBMP)
{
GetObject(l_hBMP, sizeof(l_BMP), &l_BMP);
// i use this in my current project: l_pTexture->iGenTexture(l_BMP.bmWidth, l_BMP.bmHeight, GRI_COLOR_BGR, l_BMP.bmBits);
// now the raw bitmap data in BGR order is lcated at l_BMP.bmBits, and in the prevoius line you can see how to get the width and all too...
DeleteObject(l_hBMP);
}
This works fine for me... thanks to NeHe''s lesson 37 (the last one)
p.s: please excuse me for not using those weird codes for text formatting...
HBITMAP l_hBMP=(HBITMAP)LoadImage(GetModuleHandle(0),"yourbitmap.bmp",IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
BITMAP l_BMP;
if (l_hBMP)
{
GetObject(l_hBMP, sizeof(l_BMP), &l_BMP);
// i use this in my current project: l_pTexture->iGenTexture(l_BMP.bmWidth, l_BMP.bmHeight, GRI_COLOR_BGR, l_BMP.bmBits);
// now the raw bitmap data in BGR order is lcated at l_BMP.bmBits, and in the prevoius line you can see how to get the width and all too...
DeleteObject(l_hBMP);
}
This works fine for me... thanks to NeHe''s lesson 37 (the last one)
p.s: please excuse me for not using those weird codes for text formatting...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement