Public Group

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

## Recommended Posts

I am trying to create a function for my map editor that will allow me to load any .bmp file, without first describing it's dimensions statically. Ok, I am not sure if that made sense or not, so I will just show you an example of what I am talking about: (Note this is in VB)
ddsquare.lFlags = DDSD_CAPS
ddsquare.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsquare.lHeight = 32
ddsquare.lWidth = 32
Set square(intSquareAssign) = DD.CreateSurfaceFromFile(strTileFileNames(intSquareAssign), ddsquare)

Is there anyway that you could open up the .bmp file as a binary file and then get the dimensions that way? Or is there a simpler method to doing this? Sorta like this: [pseudo code] load pic.bmp read width read height ddsquare.lHeight = height ddsquare.lWidth = width [/pseudo code] Any help would be appreciated :)

##### Share on other sites
I'm not very familiar with DirectDraw itself, but I do know that the later DirectX stuff would accept a width and height of both 0. If they were both zero, then it would load the file and create a texture the was the same size as the image (well, maybe larger, depending on hardware requirements, but you're just working with surfaces, so this is likely irrelevant). You could then query the surface information to find out what size it was (and a structure could also optionally be filled in with information about the original file).

Read the docs closely, and you'll find that they often describe such behavior.

##### Share on other sites
It doesn't say anything about that in the docs, but yes, changing it to 0 seems to work. Thanks for your help :)

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002266
×