rick@sara70.UUCP (rick) (12/13/84)
I encountered a problem when using CopyBits: VAR MyBitMap : BitMap; MyPattrn : Pattern; { 8 bits by 8 bits } BEGIN MyBitMap.baseAddr:= @MyPattrn; MyBitMap.rowBytes:= 1; { 8*8 pixels } SetRect(MyBitMap.bounds, 0,0,8,8); { 8*8 pixels } CopyBits(MyBitMap, MyW.port.portBits, srcRect, dstRect, srcXor, NIL); { No mask region } END; This example causes "System error 02", Address error. It appears CopyBits cannot copy from a BitImage with rowBytes=1. When I changed my BitImage to 16*8 pixels, rowBytes=2, everything functioned ok. Does anyone know where the problem is, with me or with QuickDraw?? Thanks in advance, Rick Jansen { philabs,decvax,seismo}!mcvax!sara70!rick
johan@apple.UUCP (Johan Strandberg) (12/16/84)
In article <sara70.259> you write: >This example causes "System error 02", Address error. >It appears CopyBits cannot copy from a BitImage with >rowBytes=1. When I changed my BitImage to 16*8 pixels, >rowBytes=2, everything functioned ok. > >Does anyone know where the problem is, with me or with >QuickDraw?? The problem is that rowBytes *must* be an even number remember that the bus is 16bits and it would be *higly* ineficient to manipulate a byte at a time. To quote the Inside Macintosh (QuickDraw; page 12): The baseAddr field is a pointer to the begining of the the bit image in memory and the rowBytes field is the number of bytes in each row of the image. Both of these should always be even: a bitMap should always begin on a word boundary and contain an integral number of words in each row. _________________________Computare necesse est!______________________ Johan Strandberg Apple Computer Education Research Group [ERG] {mtxinu,dual,nsc,voder,idi,ios,sun}!apple!johan
pugh@cornell.UUCP (William Pugh) (12/17/84)
Each row of a bit map must start on an even address, and therefor rowBytes must be an even number. System ID=2 means that a word-oriented operation was attempted on a odd address. Bill Pugh Cornell