• Advertisement

Archived

This topic is now archived and is closed to further replies.

Draw TBitmap in DelphiX

This topic is 5710 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 What''s the best (fastest) way to draw a TBitmap (created in runtime) on a surface? The Tbitmap have a color that should be transparent. If I use .Draw(X,Y,TBitmap), I don''t get the transparency. If I use .BrushCopy(...), everything work but it''s very slow. Thanks / Tommy

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Sounds like you need to add the bitmap to a DXImageList and do the draw from there.

Share this post


Link to post
Share on other sites
As long as you do not create a DirectDrawSurface for your Bitmap, every attempt to draw a bitmap on a Surface will work like this:

1. Lock the surface
2. Get the Surface''s DeviceContext
3. Perform a BitBlt
4. Unlock the surface

This is obviously very slow and it does not support transparency as long as you use a complex masking system that would slow everything down even more.

So you now have to possibilities
1. Add your bitmap to the DXImageList and draw it from there (this way, your bitmap will have its own DirectDrawSurface)
2. Create an external DirectDrawSurface, draw the bitmap on it and then FastBlt this surface onto the DXDraw surface. This solution is a lot more complicated and not very pretty either.

Share this post


Link to post
Share on other sites

  • Advertisement