Archived

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

(Un)DelphiX

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

ok I am looking for a tad of code illustrating how to do something. To speed things up, I want a certain image to be drawn already, and not at every Timer interval. I know I can use a normal TBitmap and then switch to the canvas and use Release, but that slows things down ALOT. So, I was thinking of adding an item to my DXImageList and create the offscreen thing there. Now my problem is: How do I manipulate that DIB property? TiA.

Share this post


Link to post
Share on other sites
You can create a TDirectDrawSurface, and then draw on that as you would normally, then in each frame you can call the surface''s Draw method with your DXDraw.Surface as the destination surface parameter (or the DrawAlpha, etc. methods). Off the top of my head:

To create the image:
MySurface := TDirectDrawSurface.Create(DXDraw.DirectDraw); //can''t remember the exact params
MySurface.SetSize(Width, Height);
// Draw stuff on MySurface by drawing on it as normal

Then to draw your surface onto the backbuffer:
MySurface.Draw(DXDraw.Surface, X, Y); // Again, I can''t remember the exact params


Of course you must remember to free the surface when you''re finished with it or the form is destroyed.

Share this post


Link to post
Share on other sites