Archived

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

n0ob

hovering box over setpixel() picture..?

Recommended Posts

I''m converting my fractal program to use windows. I was planning on using SetPixel. It''s fast enough for the program, so don''t worry about that. But I''d like to be able to draw the outline of a box, for when the user zooms in. However, the box would be moving, so I''m wondering what method I should use to keep the image below the box from getting screwed up. I don''t really want to recalculate those pixels in the fractal equation, because that can take a long time. It would be hard to store the pixels somehow... Any ideas? Thanks! Kings of Chaos

Share this post


Link to post
Share on other sites
Create another bitmap DC in your main bitmap DC''s context with whatever size*scale

1) copy background to extra DC using the x/y coords

2) draw enlarged background within box (would stretchblt work?)

3) flip or bitblt (implies you need yet another DC (backbuffer) for non-flickering results

4) get new x/y coords via movement, etc

5 put background from extra DC back onto now the old x/y coords


and put your redraw code into the WM_PAINT message handler, that way you can''t mess it up when you minimize

I fseek, therefore I fam.

Share this post


Link to post
Share on other sites
Instead of drawing directly to the window, draw instead to a bitmap in memory. Each time you want to update your window without updating the fractal itself you can simply paint the bitmap to the screen without recalculating. When you need to recalculate then you can draw to the bitmap again.



Qui fut tout, et qui ne fut rien
Invader''s Realm

Share this post


Link to post
Share on other sites