Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!unmvax!ddnvx1!Path-Lost From: GALETTI@uservx.afwl.af.mil Newsgroups: comp.sys.amiga.tech Subject: Re: Intuition graphics help wanted Message-ID: <11828@uservx.afwl.af.mil> Date: 14 Sep 90 20:17:49 GMT References: <1237000014@uxa.cso.uiuc.edu> Lines: 56 In article <1237000014@uxa.cso.uiuc.edu>, ragg0270@uxa.cso.uiuc.edu writes: > Subject: Pixel flashing in Intuition > Newsgroups: comp.sys.amiga.tech > > Hi all, > I've just finished writing a program that works great for me except > for one thing and I was wondering if anyone could give me some help. Basically, > I have some points drawn on a black background in a window. While looking > at this window, I am drawing into another and then using WindowToFront() when > I want to view the other window. The only thing I don't like is that when I > call WindowToFront(), the points flash a color that is loaded in a different > register before they disappear. Why does this happen and is there any way > to make it stop. I really don't want to abandon Intuition, since I want to > use menus, etc. > > Thanks, > Richard > ragg0270@uxa.cso.uiuc.edu The reason this happens is because when you call WindowToFront() the blitter copies this data to the front rastport one bitplane at a time. Consequently, when the blitter finishes one bitplane but hasn't finished some of the others, the color for each pixel is different than when all the data has been transferred. For example, suppose you are using two bitplanes/four colors: COLOR 0: black (0, 0 in bitplanes 1 & 2) COLOR 1: red (1, 0 in bitplanes 1 & 2) COLOR 2: green (0, 1 in bitplanes 1 & 2) COLOR 3: blue (1, 1 in bitplanes 1 & 2) Now, let's suppose the window is initially black (all zeros) and you are copying a dot that is blue to this initially black screen. You copy the first bitplane and you've got a one at this pixel's location in bitplane 1, but the second bitplane still has a zero at this location, so, the color that momentarily appears is red. Finally, after you've copied the second bitplane and properly replaced the zero in the second bitplane with a one, the color (1, 1) appears and the dot turns blue. The best way around this would be to double-buffer the display. Double- buffering lets you write into an invisible area while you're displaying a static, unchanging area. Then, when all of your modifications are done with the inivisible area, the copper is told to display the invisible area and thus stop displaying the static area. Now you write into the new invisible area while displaying the other area and repeat the process every time you update or change the display. Another way to fix this problem would be to temporarily assign all of your colors to the background color. This way, no matter what combination of bitplanes appears in the window, everything looks like the background color. Then, when you're done, switch back to your original color set and your points will instantaneously appear the color you want. I'd be curious to know how well this technique works. Please let me know if this helps. -Ralph Galetti