Sign in to follow this  

Loading an Image with DirectDraw/VB

This topic is 4838 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

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 this post


Link to post
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 this post


Link to post
Share on other sites

This topic is 4838 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this