(FILECREATED "26-Jul-84 21:08:08" {ERIS}<LISPCORE>DIG>OCURVE.;1 4245 changes to: (VARS OCURVECOMS) (FNS ORIGCURVE)) (* Copyright (c) 1984 by Xerox Corporation) (PRETTYCOMPRINT OCURVECOMS) (RPAQQ OCURVECOMS ((FNS ORIGCURVE))) (DEFINEQ (ORIGCURVE [LAMBDA (X0 Y0 X1 Y1 DX DY DDX DDY DDDX DDDY N BRUSHBM DISPLAYDATA BBT ENDING USERFN DISPLAYSTREAM) (* edited: "26-Jul-84 20:31") (DECLARE (LOCALVARS . T)) (* Puts a spline segment down. Since it calls BitBlt1 directly, it must clip to both clipping region and the size of the destination bit map.) (PROG (OLDX X Y OLDY DELTAX DELTAY DELTA TX TY OOLDX OOLDY ORIGX ORIGY) [COND ((NEQ N 0) [COND (USERFN (* if there is a user fn, stay in his coordinates.) (SETQ OLDX X0) (SETQ OLDY Y0)) (T (SETQ OLDX (\DSPTRANSFORMX (IDIFFERENCE X0 (LRSH BRUSHWIDTH 1)) DISPLAYDATA)) (SETQ OLDY (\DSPTRANSFORMY (IDIFFERENCE Y0 (LRSH BRUSHHEIGHT 1)) DISPLAYDATA] (* draw origin point) (\CURVESMOOTH OLDX OLDY USERFN DISPLAYSTREAM) (* convert the derivatives to fractional representation.) (* \CONVERTTOFRACTION always returns a large number box.) (SETQ ORIGX (FPLUS OLDX .5)) (* Keep the original integer part of X in ORIGX, to use as a translation. This avoids overflow in the fixed format fields) (SETQ ORIGY (FPLUS OLDY .5)) [SETQ X (\CONVERTTOFRACTION (FDIFFERENCE ORIGX (SETQ ORIGX (FIX ORIGX] (SETQ OLDX (IDIFFERENCE OLDX ORIGX)) (* Start X off with just the fractional part) [SETQ Y (\CONVERTTOFRACTION (FDIFFERENCE ORIGY (SETQ ORIGY (FIX ORIGY] (SETQ OLDY (IDIFFERENCE OLDY ORIGY)) (SETQ DX (\CONVERTTOFRACTION DX)) (SETQ DY (\CONVERTTOFRACTION DY)) (SETQ DDX (\CONVERTTOFRACTION DDX)) (SETQ DDY (\CONVERTTOFRACTION DDY)) (SETQ DDDX (\CONVERTTOFRACTION DDDX)) (SETQ DDDY (\CONVERTTOFRACTION DDDY)) [for I from 1 to N do (* uses \BOXIPLUS to save box and also set the new value of the variable.) (\BOXIPLUS X DX) (\BOXIPLUS DX DDX) (\BOXIPLUS DDX DDDX) (\BOXIPLUS Y DY) (\BOXIPLUS DY DDY) (\BOXIPLUS DDY DDDY) (SETQ OOLDX OLDX) (SETQ OOLDY OLDY) (SETQ DELTAX (IDIFFERENCE (SETQ OLDX (\GETINTEGERPART X)) OOLDX)) (SETQ DELTAY (IDIFFERENCE (SETQ OLDY (\GETINTEGERPART Y)) OOLDY)) (SETQ DELTA (IMAX (IABS DELTAX) (IABS DELTAY))) (COND ((EQ DELTA 1) (\CURVESMOOTH (IPLUS ORIGX OLDX) (IPLUS ORIGY OLDY) USERFN DISPLAYSTREAM)) ((IGREATERP DELTA 1) (SETQ DELTAX (\CONVERTTOFRACTION (FQUOTIENT DELTAX DELTA))) (SETQ DELTAY (\CONVERTTOFRACTION (FQUOTIENT DELTAY DELTA))) (SETQ TX (\CONVERTTOFRACTION OOLDX)) (SETQ TY (\CONVERTTOFRACTION OOLDY)) (for I from 0 to DELTA do (\CURVESMOOTH (IPLUS ORIGX (\GETINTEGERPART TX)) (IPLUS ORIGY (\GETINTEGERPART TY)) USERFN DISPLAYSTREAM) (\BOXIPLUS TX DELTAX) (\BOXIPLUS TY DELTAY] (* draw the end point) (COND (USERFN (\CURVESMOOTH X1 Y1 USERFN DISPLAYSTREAM)) (T (\CURVESMOOTH (\DSPTRANSFORMX (IDIFFERENCE X1 (LRSH BRUSHWIDTH 1)) DISPLAYDATA) (\DSPTRANSFORMY (IDIFFERENCE Y1 (LRSH BRUSHHEIGHT 1)) DISPLAYDATA) NIL DISPLAYSTREAM))) (AND DISPLAYSTREAM (MOVETO X1 Y1 DISPLAYSTREAM] (COND (ENDING (\CURVESMOOTH (IPLUS \CURX \CURX (IMINUS \OLDX)) (IPLUS \CURY \CURY (IMINUS \OLDY)) USERFN DISPLAYSTREAM) (\CURVESMOOTH (IPLUS \CURX \CURX (IMINUS \OLDX)) (IPLUS \CURY \CURY (IMINUS \OLDY)) USERFN DISPLAYSTREAM))) (RETURN NIL]) ) (PUTPROPS OCURVE COPYRIGHT ("Xerox Corporation" 1984)) (DECLARE: DONTCOPY (FILEMAP (NIL (253 4168 (ORIGCURVE 263 . 4166))))) STOP