From: Stefan S. <1S...@gm...> - 1998-03-14 21:16:52
|
Hi, I want to announce my final screen locking mechanism. Because of the architecture of Windows, especially DirectDraw, it is not possible to access the screen bitmap all the time. To draw something you have to lock the screen bitmap to get a pointer to it. After this you can access it as usual. When you have finished you must unlock the screen bitmap again. This is currently only needed for the screen bitmap. Because of this I have created two functions at the moment: lock_screen and unlock_screen. To draw something onto the screen bitmap you have to do the following: lock_screen(); putpixel(screen, x, y, color); unlock_screen(); Of cause you don't need this for every command. It would be enough if you only use it around you drawing code one time. To be able to allow memory bitmaps that are based on DirectX surfaces it could be possible in the future that you have to use the locking functions for them too. Because of this it would be better to call the locking functions "lock_bitmap" and "unlock_bitmap". This way you can easily use the to be locked bitmap as argument: lock_bitmap(screen); ...drawing code... unlock_bitmap(screen); or lock_bitmap(double_buffer); ...drawing code... unlock_bitmap(double_buffer); DirectX allows the creation of bitmaps in the video memory that are NOT visible on the screen. The advantage is that many current chipsets provide an hardware accelerated blit routine from VRAM to VRAM. A double buffering application would get a nice speedup. For this a new function like create_video_bitmap could be created. Unfortunately Shawn has used the name lock_bitmap elsewhere. Do you know a better unused name? Is lock_bitmap used in any user programs or is it only used by Shawn? If the last is true, I could rename Shawn's version to _lock_bitmap or something similar. Something important that I have to mention is that between a lock and an unlock you are not allowed to use function other than the Allegro drawing functions. Otherwise a complete deadlock is possible because Windows isn't working while the lock is active. I think this approach is better the older one. It's very flexible and allows direct memory access. In DosAllegro the locking routine would be short stubs that do nothing. Bye Stefan __ ___ ____ ____ ____ _ _ / )/ __)(_ _)( ___)(_ _)( \( ) )( \__ \ )( )__) _)(_ ) (__)(___/ (__) (____)(____)(_)\_) ------------------------------------------------------------ - 1Stein-Software - http://1Stein.home.pages.de - 1S...@gm... Everything is possible, at least in theory |