oecheruo@silver.ucs.indiana.edu (Chima Echeruo) (06/07/91)
Hi, I have been working on an alternative GUI system for plain DOS,Turbo BGI and TP 5-6. I would like to support most of the GIU section of WIN3/MAC without the GDI and other bitlevel graphics work. I expect to use ONLY the borland BGI that is standard along with some SVGA BGI drivers posted recently. My problem involves the methodology and logic of repainting exposed and destroyed regions of windows. Initially I began with saving a bitmap of the underlying regions of popped-up windows. It seemed to work fine and gave me the least problems. That was before I decided that I wanted random access windows (not just stacked). Also, using TP 6.0, 384KB EMS and DOS 3.3 left me with only about 150 KB or so for background bitmaps. What I wanted to do was find the most efficient way of updating window regions that are destroyed or exposed without having each window procedure to implement it's own methods. I have looked at several GUI packages: WNDX,MENUET,ZINC,and a shareware toolkit posted to comp.binaries.ibm.pc. The three commercial packages were underspec. They were LARGE and the windows were either inconsistent with WIN3/MAC or they were slow and cumbersome. These packages required MetaWindows - a third party GDI library. BGI does NOT allow virtual windows written to RAM and does only but the basic functions that a GUI would need. I have to use it. So, without using MS Windows 3.0 SDK. How can I get some pointers or code to demonstrate the updating of hidden windows,exposed regions and destroyed regions? I enclose a post I made to comp.lang.pascal a while ago including some p-code that I was thinking off. Also, how does WIN3 handle the updating of destroyed and exposed window regions? ---------------------------------------------------------------------------- I am still working on my simple user interface library for TP 5 & 6. I have built most of the messaging system, window management and data structures - bitmaps, ICONS etc.. In order to allow flexiblity for custom repainting of exposed windows I have decided not to simply 'GetImage the underlying screen background but to send messages to each window when its contents are over- written. The window procedure then has the oppurtunity to 'GetImage the portion of his window that is about to be overwritten. Later on, when the window system discovers that a previously hidden region is about to be exposed, it sends an EXPOSE message to the window with the region as the parameter. The window can then 'PutImage the previously saved bitmap without having to get the input focus (bring it's window to the top). Since this procedure is very common for most windows, the base window class will have defined procedures to handle the DESTROY/EXPOSE messages in case the window or it's derivatives decide not to handle the messages. Right now, I have a rough idea of the kind of data structures I am looking for: RECT = Record left,top,right,bottom :integer; end; RegPtr = ^REGION; REGION = Record rc :RECT; next :RegPtr; end; I will need a function say, InvalidateRegion: procedure InvalidateRegion(var rgn :REGION) { wnd:=First(WindowList); {sorted by focus} while (rgn is valid) and (wnd<>NIL) { destroyed_reg:=intersection(rgn,wnd^.region); if (destroyed_reg is valid) then sendmessage(wnd,DESTROYED,0,0,addr(destroyed_reg)); rgn:=subtract_region(rgn,destroyed_reg); wnd:=Next(wnd); } free(regions, etc..); } the way I have it, most of the destroyed background ends up being sent to the background window which can then paint it (during EXPOSE) with whatever color or pattern that a user selects (or even a bitmap). My problem is with a suitable subtract,intersect etc.. routine that works efficiently and can handle non-contigious RECTs and consolidate them to one if possible. The RECT routines that I have seen only work with simple rectangles and cannot create multiple non-contigious rects (Regions). Does anyone have some pointers to some code? also, I know that Windows 3 exists but I cannot afford the SDK nor do I need the power of a REAL GUI. I am looking at a SMALL GIU library that can get my PC to look like a MAC without much work on the programmer's part. thanks. Chima Echeruo -- ------------------------------------------------------------------------------- ----- Chima Oke Echeruo ----- oecheruo@silver.ucs.indiana.edu ++++++ oecheruo@amber.ucs.indiana.edu -------------------------------------------------------------------------------