Annotation of researchv10dc/vol2/Faces/How/stretch.pico, revision 1.1

1.1     ! root        1: def zclamp(n) {
        !             2:        return (n>0)?(n<Z)?n:Z:0;
        !             3: }
        !             4: def init() {
        !             5:        for (y = 0; y < Y; y++)
        !             6:        for (x = 0; x < X; x++)
        !             7:                new[x,y]=y*Z/(Y-1)
        !             8: }
        !             9: def refresh() {
        !            10:        for (y = 0; y < Y; y++)
        !            11:        for (x = 0; x < X; x++)
        !            12:                new[x,y]=old[x,y]
        !            13: }
        !            14: def mapper(t0, t1, f0, f1, h, mult) {
        !            15:        int dy, blah
        !            16:        if (abs(t0-t1)>1)
        !            17:        {       mapper((t0+t1)/2, t1, (f0+f1)/2, f1, h, mult)
        !            18:                mapper(t0, (t0+t1)/2, f0, (f0+f1)/2, h, mult)
        !            19:        } else
        !            20:                new[t0, h] = zclamp(((100-mult)*$P2[f0, h] +(mult)*$P1[t0,h])/100)
        !            21: }
        !            22: def Mapp(factor) {
        !            23:        int start1, start2, end1, end2, dy, mult;
        !            24:        init()
        !            25:        for (y = 0; y < Y; y++)
        !            26:        {       x = 10;
        !            27:                while ($M1[x,y] < 128 && x < X)
        !            28:                        x++;
        !            29:                start1 = x;
        !            30:                x = X-10;
        !            31:                while ($M1[x,y] < 128 && x > 0)
        !            32:                        x--;
        !            33:                end1 = x;
        !            34:                x = 10;
        !            35:                while ($M2[x,y] < 128 && x < X)
        !            36:                        x++;
        !            37:                start2 = x;
        !            38:                x = X-10
        !            39:                while ($M2[x,y] < 128 && x > 0)
        !            40:                        x--;
        !            41:                end2 = x;
        !            42:                if (start1 < end1 && start2 < end2)
        !            43:                {       start1 = start2 + ((start1 - start2)*factor)/100
        !            44:                        end1 = end2 + ((end1 - end2)*factor)/100
        !            45:                        mapper(start1, end1, start2, end2, y, factor)
        !            46:                } else
        !            47:                {       for (x = 0; x < X; x++)
        !            48:                                new[x,y] = old[x,y]
        !            49:                }
        !            50:        }
        !            51: }
        !            52: x {
        !            53:        Mapp(0); putframe(0); swap(); refresh()
        !            54:        Mapp(100); putframe(100); swap(); refresh()
        !            55: }

unix.superglobalmegacorp.com

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