Jump to content

  • Log In with Google      Sign In   
  • Create Account


DWORD to surfaces


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 03 December 1999 - 11:58 AM

I've saved a bitmap to a giant DWORD array and want to convert it to a surface. How should I approach this? By put-pixeling each pixel to the surface?

Sponsor:

#2 magal   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 05:29 PM

I guess that's the only way.
But why the hell did you save the bitmap into a DWORD array anyway? Couldn't you just have used the usual GDI32 bitmap load functions???


#3 WhiteHouse   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 07:43 PM

I'd say use memcopy instead of plotting pixel by pixel in some huge for/while loop.

#4 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 December 1999 - 01:18 PM

Do a Lock on the surface, memcpy, and Unlock.

------------------

-Kentamanos


#5 Starfall   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 December 1999 - 03:28 PM

Remember to memcpy line by line and increment your destination pointer by the pitch of the surface... otherwise you may run into weird problems on some video cards.

Good luck

Starfall


#6 AlexM   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 December 1999 - 07:44 AM

yeah, unless you've got different pixel formats here... in which case you should use putpixel, i think it does the conversions.. why don't you just load it into a win bitmap and use BitBlt?

#7 Aidan   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 December 1999 - 11:58 AM

if the pixel format of your DWORD array is the same as the format of the surface you can use the SetSurfaceDesc function of the DirectDrawSurface with a DDSURFACEDESC where the lpSurface ptr is set to the start of your array and the dwFlags member is set to DDSD_LPSURFACE. The DDSurface will use the array as surface memory, but won't delete the array.
I think you can even create a Surface with a set DDSURFACEDESC.lpSurface member, to create the surface you want.

So refer to the DirectDraw reference.

-> Aidan





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS