[comp.sys.amiga] Problem setting drawmodes

john13@garfield.UUCP (John Russell) (01/11/88)

Is there a recommended way to determine the drawmode of a rastport so that it
can be restored later? The rastport isn't mine so what I have been doing is
reading the DrawMode tag straight from the RastPort structure.

The sequence goes something like this:

- LockLayerRom a window
- read DrawMode variable
- set DrawMode to complement
- draw rubber-band box in window, erase when done
- SetDrMd using the DrawMode read earlier
- UnlockLayerRom the window

Now if nothing is writing into the window when I do this, it works fine. And
about 50-75% of the time, even if the window is being written to or scrolling
when I do it the drawmode gets changed back properly.

However fairly frequently the window will remain in COMPLEMENT mode, and stays
that way under almost every subsequent condition (though I have found 1 program
that resets it - this is a con: window I am talking about).

Something else I tried was reading both the Flags and DrawMode values directly
and sticking them back in manually when I was finished. Also no go.

So exactly which structure values do I have to preserve in the rastport when
I finish? Perhaps one or more of the drawing pens, or window structures in
addition to the rastport ones?

Help on this will be appreciated, version 1 of this program would be posted
by now if this hadn't happened.

John

PS Just try doing "ln" sometime with your CLI in complement mode ;-).
-- 
"Operating systems room, prepare for shutdown."
"I never thought I'd be HAPPY to see our ratings do DOWN!"
		-- lots of these were sprinkled throughout the 
		   last broadcast episode of _Max_Headroom_

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (01/13/88)

In article <4364@garfield.UUCP> john13@garfield.UUCP (John Russell) writes:
>Is there a recommended way to determine the drawmode of a rastport so that it
>can be restored later?  [ ... ]
>
>However fairly frequently the window will remain in COMPLEMENT mode, and stays
>that way under almost every subsequent condition (though I have found 1 program
>that resets it - this is a con: window I am talking about).
>
	Since this RastPort belongs to someone else, if it were me doing
this, I'd Xerox the RastPort and bang on the resulting copy.  I'd keep the
LockLayer() calls in to prevent the CON: handler from rendering into or
scrolling the window, thus pulling the rug out from under me.

Disclaimer:  Xerox is a *VERB*.  So there.			:-)

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	ihnp4!ptsfa -\
 \_ -_		Recumbent Bikes:	      dual ---> !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor