pj@pnet51.orb.mn.org (Paul Jacoby) (12/20/90)
I am in the process of writing some simple graphics routines for a modeling program. I have a screen which displays a grid filled with arrows. On each arrow, I draw an arrowhead (how appropriate!). I then want to turn control over the user, giving them the ability to vary parameters which make the arrows swing like little VU meters (whooopee!). Problem: I draw the arrows (based on an array of endpoints) using PenMode(patXor), and then go in an add the heads. If I leave the PenMode as patXor, I end up knocking a few pixels out of the arrowshaft, at the points where the head and shaft meet. However, if I change the PenMode to srcCopy, I then have to figure out how to ERASE the arrowhead...using patXor seems so convenient for the shaft, I'd love to use it for the head too. But those dropped pixels look awful. Question: Is there a transfer mode that will draw on TOP of those already-existing black pixels in such a way that RE-drawing will erase (as per XOR)? Or am I better off to read farther into IM and other references, learn how to use copyBits, and give up drawing the individual arrowhead lines one at a time? .-----------------------------------------------------------------------------. | UUCP: {crash tcnet}!orbit!pnet51!pj | RTFD = Read The Silly Doc! | | INET: pj@pnet51.orb.mn.org | | `-----------------------------------------------------------------------------'
kempkec@mist.CS.ORST.EDU (Christopher Kempke) (12/26/90)
In article <3666@orbit.cts.com> pj@pnet51.orb.mn.org (Paul Jacoby) writes: >I am in the process of writing some simple graphics routines for a modeling >program. I have a screen which displays a grid filled with arrows. On each >arrow, I draw an arrowhead (how appropriate!). I then want to turn control >over the user, giving them the ability to vary parameters which make the >arrows swing like little VU meters (whooopee!). > >Problem: I draw the arrows (based on an array of endpoints) using >PenMode(patXor), and then go in an add the heads. If I leave the PenMode as >patXor, I end up knocking a few pixels out of the arrowshaft, at the points >where the head and shaft meet. However, if I change the PenMode to srcCopy, I >then have to figure out how to ERASE the arrowhead...using patXor seems so >convenient for the shaft, I'd love to use it for the head too. But those >dropped pixels look awful. > srcOr will do what you want, not dropping the pixels. "Erase" is generally a srcBic (Bit Clear) operation. Page I-157 of Inside Macintosh (I) gives little pictures demonstrating this. You'll have to do this in four steps: srcXor - Draw the shaft srcOr - Draw the head srcXor - Erase the shaft srcBic - Erase the head This assumes that your "heads" don't occlude anything but the shaft. If this isn't the case, then no, there's no solution (no pattern mode will determine "for" you that a given black dot comes from the "shaft" rather than some other object.) Hope this is clear, write me email if you need more. (Sorry for posting this, but I see the question or one like it a lot here.) --Chris Kempke (kempkec@mist.cs.orst.edu)
d88-jwa@nada.kth.se (Jon W{tte) (12/26/90)
In article <1990Dec26.111555.3333@usenet@scion.CS.ORST.EDU> kempkec@mist.CS.ORST.EDU (Christopher Kempke) writes: >In article <3666@orbit.cts.com> pj@pnet51.orb.mn.org (Paul Jacoby) writes: >>Problem: I draw the arrows (based on an array of endpoints) using >>PenMode(patXor), and then go in an add the heads. If I leave the PenMode as >>patXor, I end up knocking a few pixels out of the arrowshaft, at the points > srcOr will do what you want, not dropping the pixels. "Erase" is > generally a srcBic (Bit Clear) operation. Page I-157 of Inside > This assumes that your "heads" don't occlude anything but the shaft. > If this isn't the case, then no, there's no solution (no pattern mode I see several solutions: 1) Draw the arrow (both shaft and head) as a region, which you then fill using patXor. This might be slow. 2) _CopyBits the bounding box of the arrow BEFORE the arrow is drawn. then erase it by CopyBitsing back what was there before, and make a new copy of what is at the new place. This might flicker. Happy hacking, h+@nada.kth.se -- Jon W{tte, Stockholm, Sweden, h+@nada.kth.se