Path: utzoo!attcan!uunet!mcsun!unido!mpirbn!p554mve From: p554mve@mpirbn.UUCP (Michael van Elst) Newsgroups: comp.sys.amiga.tech Subject: Re: How do you draw to the screen quickly? Message-ID: <552@mpirbn.UUCP> Date: 11 Feb 90 14:24:17 GMT References: <21908@pasteur.Berkeley.EDU> Reply-To: p554mve@mpirbn.UUCP (Michael van Elst) Organization: Max-Planck-Institut fuer Radioastronomie, Bonn Lines: 30 In article <21908@pasteur.Berkeley.EDU> Jamie Zawinski writes: >Given a one-dimensional array of 8 bit (greyscale) quantities, I need to be >able to draw one scanline. There must be a way to do this without repeatedly >calling WritePixel(), right? (I realize that the Amiga can only display four >bits of grey, but 8 bits is used interally by the program, and I'd rather >not alter its portable data structures.) Any ideas? The fastest way to fill lines is to move them right into the display bitmap. You have to split the incoming pixel values into bits, say 32 pixels at a time and construct the memory words that are needed for bitplanes. Since you only want to display 16 colors you might use 4 registers where the four longwords for each bitplane are assembled. Now that's for 68000 programmers but a good C-compiler could achieve nearly the same performance. One problem still arises, if you write into the screens bitmap you get into collisions with intuition rendering (like menus). And arbitrarily positioned windows are another hack. All these problems can be avoided if you put your pixels into an offscreen bitmap (pretty aligned, no locking needed). And then make a call to BltBitMapRastPort to move the data onto the screen. If you consider speed you may use double buffering. When one bitmap is drawn, the second can be copied to the screen. Note that it is not as easy to do completely asynchronous blitter operations. The simplest way is to use another drawing task that calls the graphics functions. Michael van Elst uunet!unido!mpirbn!p554mve