Sign in to follow this  

Getting a RECT from a directdraw surface? [RESOLVED]

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

Hello! Does anyone know if there's a way of getting a size RECT from a surface in DirectDraw? I need one for clipping, because at the moment I use the bitmap size at loadtime, but it's not very efficient or dynamic. Thanks for any help [Edited by - Naigewron on October 9, 2004 12:04:45 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Call something like GetSurfaceDesc on the surface you want, and the DDSD structure it returns will have the width and height.

Share this post


Link to post
Share on other sites
do you mean the size of the whole surface or just a section of the surface? if you mean the whole surface, you would have needed to specify the size on creation of the surface anyway... but if you need to find the size still, try the dwWidth and dwHeight properties of the surface description you needed to use to make the surface. for example:

//you would have your surface description declared:
DDSURFACEDESC2 ddsd;
//..and your RECT structure declared:
RECT size;
/*now you would set up dx and sizes and everything else... OR
load the bitmap onto a surface (which is what i understand ur doing)*/

//...
/*now you've set up dx/image surface and are ready to set 'size' up:
you would use 'ddsd''s dwWidth and dwHeight properties to get the surface size:*/

size.Left = 0;
size.Top = 0;
size.Right = ddsd.dwWidth;
size.Bottom = ddsd.dwHeight;

/*now you have the size of the surface in your 'size' RECT struct!*/




i really hope that all made sense and that its what ur asking for! if not, please specify more clearly what u r trying to achieve ;)

the_moo

edit: hey a fellow aussie! its nice to see someone on here from the same country!

Share this post


Link to post
Share on other sites

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