Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!cbfsb!cbnewsb.cb.att.com!sladkey From: sladkey@cbnewsb.cb.att.com (john.r.sladkey..jr) Newsgroups: comp.sys.3b1 Subject: Re: calculation of srcwidth and dstwidth for wrastop() Message-ID: <1991Apr19.203631.9169@cbfsb.att.com> Date: 19 Apr 91 20:36:31 GMT References: <1991Apr19.133128.22408@uncecs.edu> Sender: news@cbfsb.att.com Distribution: na Organization: AT&T Bell Laboratories Lines: 33 In article <1991Apr19.133128.22408@uncecs.edu> tcamp@uncecs.edu (Ted A. Campbell) writes: > I am writing an application utilizing tam() and wrastop() > routines for graphics output... > ...The wrastop() routines allow this, but > the calculation of the srcwidth and dstwidth parameters > remains a great mystery to me. Why, if the rectangle > width is specified later, do these parameters need to > be given. I too struggled with this question. Eventually, I figured out that one need not always blit WHOLE bitmaps! Full bitmaps have dimensions which make sense. The x dimension is rounded up to the next multiple of 16 to get whole 68000 words, then multiplied by 2 to get the width in bytes. This looks like: /* hand optimization of this seemingly simple formula is left as an exercise for the reader (grin) */ width = (dx + 15)/16 * 2; Now that RASTOP knows the full byte-wise row-size it can do the proper row/column addressing to get at the individual bytes and bits. (One of my gripes with C lang is that ordinary (static) multi-dimensional arrays cannot be passed to a function without a lot of hassle, this example is a case in point.) Now if you want to blit a small portion of this bitmap, just limit the dx and dy to your desired size. In any case, RASTOP needs to know (and cannot figure out any other way) what the actual bitmap dimensions are. Rick Sladkey mvjrs@mvgpk.att.com