File:  [NeXTSTEP 3.3 examples] / Examples / AppKit / BackspaceViews / Bezier / BezierWraps.psw
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:32 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

/* ------------ These wraps are all for bezier ---------------- */
/* This bezier hack was mostly written by mike dixon.  -s 		*/

defineps PSWbezierCreate()

	128 array /myArray exch def
	
	/h 0 def	%starting hue

	/setnewcolor	%tweak the hue
	{
		h 1 50 div add
		dup 1 gt { 1.0 sub } if
		dup /h exch def
		1 1 sethsbcolor
	} def


	/adj { % dx
        rand 50000000 idiv add dup 0 le {-5}{5} ifelse add }
	bind def % dx'

	/upd { %  dx x max
   	     yield exch 2 index add 2 copy le  % dx max x' over?
    	    { 1 index sub sub exch neg adj neg exch }
     	   { exch pop dup 0 lt { neg exch adj exch } if }
     	   ifelse }
	bind def % dx' x'

	/xtr { % dxa xa dya ya dxb xb dyb yb ...
 	       14 index 13 index 12 index 11 index 10 index 9 index 8 index 7 index }
	bind def % dxa xa dya ya dxb xb dyb yb ... xa ya xb yb ...

	/updl { % dxa xa dya ya dxb xb dyb yb ...
   	     xtr 24 8 roll
    	    4 { ht upd 16 2 roll wd upd 16 2 roll } repeat
     	           % xa ya xb yb ... dxa' xa' dya' ya' dxb' xb' dyb' yb' ...
			setnewcolor xtr moveto curveto stroke
     	   }
	bind def

	/updlNoDraw {
   	     xtr 24 8 roll
    	    4 { ht upd 16 2 roll wd upd 16 2 roll } repeat
			xtr 8 { pop } repeat
     	   }
	bind def

endps

defineps PSWbezierInit(float width, height)

	/wd width def
	/ht height def

	1 1 2 1 3 1 4 1      5 1 6 1 7 1 8 1
	14 { updlNoDraw } repeat
	myArray astore pop
	
endps

defineps PSWbezierOneStep()

myArray aload pop
128 -8 roll 0 setgray moveto curveto stroke updl
myArray astore pop

endps

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.