Sign in to follow this  

surface data

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

It's me, again :D
May someone give me some explanations about how surfaces hold color data?
I thought that sing LockRect you get a pointer (pBits) to an array of DWORDS of size width*height*sizeof(DWORD).
So i wrote this function, to get the color value of one pixel in a surface
[code]DWORD SurfaceGetPixelColor(LPDIRECT3DSURFACE9 surface, int x, int y)
{
RECT rectangle;

rectangle.left = x;
rectangle.top = y;
rectangle.right = x+1;
rectangle.bottom = y+1;
surface->LockRect(&getpix_desc,&rectangle,D3DLOCK_READONLY);
DWORD color;
memcpy(&color,getpix_desc.pBits,sizeof(DWORD));
surface->surface->UnlockRect();
return(color);
}[/code]
But i get an error for memcpy

Share this post


Link to post
Share on other sites

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