anarch@eleazar.dartmouth.edu (The Anarch) (07/04/90)
Apologies if this is an elementary question; I'm still pretty new to Mac programming. Anyway, I'm trying to get a window to come up onscreen with a black content region. Now I know that I can easily do NewWindow and then PaintRect the window's body, but that causes a brief white flash, which I'd like to avoid but have been unable to get rid of. What I *have* tried: changing the bkColor and bkPat for the window in various ways before a ShowWindow; I haven't gotten any positive results. Please reply by mail or to the net as you see fit. Thanks for your time. -- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-anarch@dartmouth.edu+-+-+-+-+-+-+-+-+-+-+-+-+-+ Thy hand, great Anarch! lets the curtain fall, And universal darkness buries all. D I S C L A I M E R : E V E R Y T H I N G I W R I T E I S F A L S E
keith@Apple.COM (Keith Rollin) (07/05/90)
In article <23026@dartvax.Dartmouth.EDU> anarch@eleazar.dartmouth.edu (The Anarch) writes: > > Apologies if this is an elementary question; I'm still pretty new to Mac >programming. Anyway, I'm trying to get a window to come up onscreen with a >black content region. Now I know that I can easily do NewWindow and then >PaintRect the window's body, but that causes a brief white flash, which I'd >like to avoid but have been unable to get rid of. What I *have* tried: >changing the bkColor and bkPat for the window in various ways before a >ShowWindow; I haven't gotten any positive results. Here's one for the oneliners file: The window Mgr doesn't use your window's bkPat when erasing the content region. No. That would be too simple, too easy. Instead, since the content region is drawn in the WMgrPort, the Window Manager uses the WMgrPort's bkPat. Since this is always white, your window's content region is always drawn in white when it is updated. There are several not-so-good ways around this. As I recall, if you have a color window, the window's rgbBkColor IS respected, and you can have your window updated in any color you want (but not pattern). You can also try munging around with the PaintWhite low-memory global, which can be used to prevent the window manager from clearing your content region to any color at all, allowing you to do it. However, there are problems with that, as Inside Mac I-297 points out. Finally, you could write a WDEF wherein the entire window is a structure region, and where there is no content region. Since the WDEF is solely responsible for drawing the strucRgn, you will have total control over how it gets redrawn. -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions
jwwalker@usceast.UUCP (Jim Walker) (07/05/90)
I thought of another "not so good way" that Keith Rollin didn't mention: Before showing your window, temporarily change the bkPat of the Window Manager port to black. Be sure to change it back to white once the window is drawn! You may also need to set the window's bkPat to black to prevent a flash. And you would probably need a custom WDEF that can draw its frame properly when the bkPat is black. (I did enough experimentation with this to convince myself that it could be made to work.) -- Jim Walker jwwalker@cs.scarolina.edu 76367.2271@compuserve.com
billkatt@mondo.engin.umich.edu (billkatt) (07/05/90)
In article <3315@usceast.UUCP> jwwalker@usceast.UUCP (Jim Walker) writes: > >I thought of another "not so good way" that Keith Rollin didn't mention: >Before showing your window, temporarily change the bkPat of the Window >Manager port to black. Be sure to change it back to white once the window >is drawn! You may also need to set the window's bkPat to black to prevent >a flash. And you would probably need a custom WDEF that can draw its frame >properly when the bkPat is black. (I did enough experimentation with this >to convince myself that it could be made to work.) Careful. Many of these "black background" solutions work differently under classic and color QuickDraw. -Steve
dowdy@apple.com (Tom Dowdy) (07/06/90)
Here's YET ANOTHER way to do this. You can judge if it is less or more terrible than those already suggested. I call it about even, but the one effect that it relies on IS documented. I place it behind the WDEF approach, and ahead of hitting fields in the WMgrPort in the cleaniness rankings. a) Open a port (PORT, not window) in the location where the window will be. b) Fill port with black c) Dispose of port. d) Slam low memory PaintWhite ($9DC) to be zero (this keeps the window manager from filling the window with white, but leaves what is behind it, ie black), save the old copy. e) Open your window, which will get the black area, and will NOT be filled with white. f) Restore PaintWhite. Tom Dowdy Internet: dowdy@apple.COM Apple Computer MS:81EQ UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy 20525 Mariani Ave AppleLink: DOWDY1 Cupertino, CA 95014 "The 'Ooh-Ah' Bird is so called because it lays square eggs."
thecloud@dhw68k.cts.com (Ken McLeod) (07/07/90)
In article <23026@dartvax.Dartmouth.EDU> anarch@eleazar.dartmouth.edu (The Anarch) writes: > Apologies if this is an elementary question; I'm still pretty new to Mac >programming. Anyway, I'm trying to get a window to come up onscreen with a >black content region. Now I know that I can easily do NewWindow and then >PaintRect the window's body, but that causes a brief white flash, which I'd >like to avoid but have been unable to get rid of. What I *have* tried: >changing the bkColor and bkPat for the window in various ways before a >ShowWindow; I haven't gotten any positive results. When a new window is created, the window manager looks at the low-memory global PaintWhite (a word at $9DC). If it's non-zero, the window's content region is erased to white; otherwise, it isn't. Something like the following has worked for me before... short savedPaintWhite; savedPaintWhite = PaintWhite; PaintWhite = 0; foo = NewWindow(...) PaintWhite = savedPaintWhite; Disclaimer/warning: this code modifies the contents of a low-memory global, and as such is Dangerous (even though IM I-297 condones the clearing of PaintWhite). -ken -- ========== ....... ============================================= Ken McLeod :. .: UUCP: ...{spsd,zardoz,felix}!dhw68k!thecloud ========== :::.. ..::: INTERNET: thecloud@dhw68k.cts.com //// =============================================