Teen Programmers Unite  
 

 

Return to forum top

how to open a bitmap by filename?

Posted by MrBlack [send private reply] at February 06, 2002, 07:23:09 PM

hi,

i'm trying to open a bitmap by filename. i need to access to data per pixel.

i have found loads of info on how to work with bitmap resources in VC++ and how to write to a bitmap structure, but not how to open a bitmap by filename. i'm beginning to get confused by the various libraries i have been playing with. and quite frustrated...

anyone know of a good resource, or example of how to access per pixel info in a bitmap that i can compile in gcc or VC?

any help would be most appreciated, Thanks.

MrBlack

Posted by sphinX [send private reply] at February 07, 2002, 12:33:21 AM

Try http://www.wotsit.org for information on the BMP format (I assume that's what you meant by bitmap). From the information there, you should be able to write a bitmap loader with which you can just dump the bitmap to an array, thus giving you pixel-by-pixel access. Although, there may be a way to access this data with the WinAPI though I wouldn't know it.

Posted by CodeRed [send private reply] at February 07, 2002, 09:53:02 AM

AUX_RGBImageRec *LoadBMP(char *Filename)
{
FILE *File=NULL;

if (!Filename){return NULL;}

File=fopen(Filename,"r");

if (File)
{
fclose(File);
return auxDIBImageLoad(Filename);
}

return NULL;
}

Posted by Cobbs [send private reply] at February 07, 2002, 09:12:53 PM

that would require linking in glaux.lib i think...

Posted by CodeRed [send private reply] at February 08, 2002, 09:43:17 AM

You're very perceptice cobbs

Posted by Cobbs [send private reply] at February 08, 2002, 04:29:16 PM

and i'm also perceptive

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.