Re: Pixel optim
- Posted by Jeffrey Fielding <JJProg at CYBERBURY.NET> Nov 26, 2000
- 374 views
On Sun, 26 Nov 2000, mic _ wrote: > >From: Alexander <Carnivals at INAME.COM> > >Anyway, do anyone know a > >optimization for this code?: > > > Just a very basic transcopy routine. doesn't do clipping or much of > anything.. > > > procedure transcopy(integer x, integer y, integer width, integer height, > integer trans, atom src, atom dest) > integer src_offset > integer pix > > src_offset = 0 > dest += (y*SCREEN_WIDTH)+x > > for i = 1 to height do > for j = 0 to width - 1 do > pix = peek(src + src_offset) > if pix!=trans then > poke(dest + j, pix) > end if > src_offset += 1 > end for > dest += SCREEN_WIDTH > end for > > end procedure > > > but if you really want speed the you might want to do this in assembly, or > check out some of the other graphics libraries available. > > > _____________________________________________________________________________________ > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com > It's even faster if you load the memory to a sequence and operate on that - using peek and poke for the whole image is much faster than peeking and poking individual bytes. Jeff