ragg0270@uxa.cso.uiuc.edu (08/28/90)
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
peterk@cbmger.UUCP (Peter Kittel GERMANY) (08/28/90)
In article <1237000014@uxa.cso.uiuc.edu> ragg0270@uxa.cso.uiuc.edu writes: >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. This is not Intuition. What happens is that when you put a window in front the layers library handles all the memory swapping involved. It uses the Blitter heavily. If your window is not miniature then it can happen that the Blitter already has worked on one of the bitplanes but has not yet done the other(s). When you are "lucky" enough to catch this moment then some area on the screen appears in different colors because one bitplane is from one window contents and the others from the other window. This is why double buffering animation techniques use always whole screens and do not change windows. To flip from one screen to another, there is not much memory blitting necessary, only a different copper list with different pointers to the different bitplanes. So this can be done fast as lightning. The same by flipping windows would lead to such intermediate color corruptions as you experience. -- Best regards, Dr. Peter Kittel // E-Mail to Commodore Frankfurt, Germany \X/ rutgers!cbmvax!cbmger!peterk
GALETTI@uservx.afwl.af.mil (09/15/90)
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