Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uwm.edu!bionet!agate!garnet.berkeley.edu!deadman From: deadman@garnet.berkeley.edu (Ben Haller) Newsgroups: comp.sys.mac.programmer Subject: Re: PICT rowBytes Keywords: PICT, rowBytes Message-ID: <1991Apr20.203304.3973@agate.berkeley.edu> Date: 20 Apr 91 20:33:04 GMT References: <327@nic.cerf.net> Sender: root@agate.berkeley.edu (Charlie Root) Distribution: usa Organization: Stick Software Lines: 25 In article <327@nic.cerf.net> moreland@nic.cerf.net (John Moreland) writes: >vague description in IM V. On page 52 and 53 the "rowBytes" field of a PICT >is described, but they don't quite tell how to calculate the "high-bits". >I know how to calculate the "raw" value of rowBytes, but what "function" >is used to set the 3 high-bits/flags ? > >I am using the "|" operator in C to set the bits, but I noticed that >a "C view" display from "PICT Detective" shows that they are using "+". >I know that these lead to very different results, but IM does not seem >to describe exactly which is correct. > >Here are a half dozen or so lines of C code that shows how *I* am >calculating rowBytes. Can somebody at Apple tell me which way is >the "right way" to set the high-bits ? > >rowBytes |= 0x8000; /* HIGH-BIT LIT MEANS "PIXMAP" */ >rowBytes &= 0x7FFF; /* UNDO THE HIGH-BIT SO WE CAN USE ROWBYTES "NORMALLY" */ You should do &= with 0x1FFF, since the three high bits are reserved by Apple. Besides this, you're fine. x+=0x8000 and x|=0x8000 will produce the same results, BTW, assuming that the high bit isn't already set, which is true of your example. -Ben Haller (deadman@garnet.berkeley.edu) "Shock the monkey to life..." - Peter Gabriel