legg@sirius.ucs.adelaide.edu.au (Christian Legg) (08/16/90)
Hello fellow programmers. I'd like to be able to draw arrow heads on the end of lines, just as Mac Draw allows one to do. I have thought of doing this with the use of rotated triangles copied into regions but am now wondering if there is any other (and maybe less memory consuming) way to do this. Alternatively, is there any code in the public domain that can do these sort of things? thanks for any help that may pass my way. Christian Legg
s8925188@mqcomp.mqcc.mq.OZ (Philip Craig) (08/16/90)
In article <1320@sirius.ucs.adelaide.edu.au> legg@sirius.ucs.adelaide.edu.au (Christian Legg) writes: > I'd like to be able to draw arrow heads on the end of lines, just as >Mac Draw allows one to do. I have thought of doing this with the use of >rotated triangles copied into regions but am now wondering if there is >any other (and maybe less memory consuming) way to do this. Alternatively, >is there any code in the public domain that can do these sort of things? I know MacDraw 1.9.5 used to do this by drawing an arc out of a circle. If you zoomed up you could see the curve on the arrowheads. The arc is good because you can cheaply (speed + memory) specify a curve and have the toolbox fill it in (with PaintArc or FillArc). ----------------------------------------------------------------- Are you sure you want to remove SUN microsystems [yes/no]? ACSnet ( s8925188@mqcomp.mq.oz ) UUCP ( uunet!munnari!mqcomp.mq.oz!s8925188 ) Internet ( s8925188%mqcomp.mq.oz@uunet.uu.net )
jackiw@cs.swarthmore.edu (Nick Jackiw) (08/16/90)
legg@sirius.ucs.adelaide.edu.au (Christian Legg) writes: > > Hello fellow programmers. > > I'd like to be able to draw arrow heads on the end of lines, just as > Mac Draw allows one to do. Try this. procedure DrawArrow (fromPt, toPt: Point); {By Nick Jackiw} {Given two quickdraw points, DrawArrow draws an arrowhead pointing to toPt} {in the direction facing away from fromPt.} const ArrowShaftLength=10; {How many pixels "long" the arrow-head is} ArrowHeadWidth=49; {# of degrees "wide" the arrow-head is...should be odd} var myAngle, dX, dY: integer; aRect: Rect; begin fromPt := PrimalToLocal(fromPt); toPt := PrimalToLocal(toPt); with fromPt do begin with aRect do begin left := h - 100; top := v - 100; right := h + 100; bottom := v + 100 end; PtToAngle(aRect, toPt, myAngle) end; with toPt do with aRect do begin top := v - ArrowShaftLength; right := h + ArrowShaftLength; bottom := v + ArrowShaftLength; left := h - ArrowShaftLength end; PaintArc(aRect, (myAngle + 180) - arrowHeadWidth div 2, arrowHeadWidth) end; -- -----Nick Jackiw [jackiw@cs.swarthmore.edu|jackiw@swarthmr.bitnet------ "This orbe of starres fixed infinitely vp extendeth hitself in altitvde sphericallye, and therefore immovable the pallace of foelicity garnished with perpetvall shining glorious lightes innvmerable." - Thomas Digges