File:  [Research Unix] / researchv10dc / vol2 / Faces / How / stretch.pico
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

def zclamp(n) {
	return (n>0)?(n<Z)?n:Z:0;
}
def init() {
	for (y = 0; y < Y; y++)
	for (x = 0; x < X; x++)
		new[x,y]=y*Z/(Y-1)
}
def refresh() {
	for (y = 0; y < Y; y++)
	for (x = 0; x < X; x++)
		new[x,y]=old[x,y]
}
def mapper(t0, t1, f0, f1, h, mult) {
	int dy, blah
	if (abs(t0-t1)>1)
	{	mapper((t0+t1)/2, t1, (f0+f1)/2, f1, h, mult)
		mapper(t0, (t0+t1)/2, f0, (f0+f1)/2, h, mult)
	} else
		new[t0, h] = zclamp(((100-mult)*$P2[f0, h] +(mult)*$P1[t0,h])/100)
}
def Mapp(factor) {
	int start1, start2, end1, end2, dy, mult;
	init()
	for (y = 0; y < Y; y++)
	{	x = 10;
		while ($M1[x,y] < 128 && x < X)
			x++;
		start1 = x;
		x = X-10;
		while ($M1[x,y] < 128 && x > 0)
			x--;
		end1 = x;
		x = 10;
		while ($M2[x,y] < 128 && x < X)
			x++;
		start2 = x;
		x = X-10
		while ($M2[x,y] < 128 && x > 0)
			x--;
		end2 = x;
		if (start1 < end1 && start2 < end2)
		{	start1 = start2 + ((start1 - start2)*factor)/100
			end1 = end2 + ((end1 - end2)*factor)/100
			mapper(start1, end1, start2, end2, y, factor)
		} else
		{	for (x = 0; x < X; x++)
				new[x,y] = old[x,y]
		}
	}
}
x {
	Mapp(0); putframe(0); swap(); refresh()
	Mapp(100); putframe(100); swap(); refresh()
}

unix.superglobalmegacorp.com

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