Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!kuhub.cc.ukans.edu!mlab2 From: mlab2@kuhub.cc.ukans.edu Newsgroups: comp.sys.mac.programmer Subject: Re: An itsy bitsy question... Message-ID: <27725.2787e3d0@kuhub.cc.ukans.edu> Date: 7 Jan 91 08:58:24 GMT References: Organization: University of Kansas Academic Computing Services Lines: 37 In article , aberno@questor.wimsey.bc.ca (Anthony Berno) writes: > I was wondering about something, partly from curiosity and partly because > I am thinking of using it myself... > > How is the "rubberbanding" done in programs like Superpaint when you are > drawing a line on the screen? There isn't an obvious solution in Inside > Macintosh, and any solutions I have come up with are hideously difficult. > There must be a relatively simple way of doing it. Does anyone out there > know? > > Thanks. > Anthony Berno. When in line-drawing-mode, a mouseDown event in the drawing window should call a procedure similar to the below: procedure RubberBand; var originalPt, lastPt, newPt : Point; begin GetMouse(originalPoint); PenMode(patXOr); GetMouse(lastPt); MoveTo(originalPt.h, originalPt.v); LineTo(lastPt.h, lastPt.v); repeat MoveTo(originalPt.h, originalPt.v); LineTo(lastPt.h, lastPt); GetMouse(newPt); MoveTo(originalPt.h,originalPt.v); LineTo(newPt.h, newPt.v); lastPt:=newPt; until (not Button); PenNormal; end; john calhoun