func p6Dec(x, y uint, p []byte) []byte { // w, h, fix, n := p6dec(p) if w == 0 || h == 0 || fix != 255 { return nil } i := 4 * clz b := make([]byte, Codelen(w, h)) copy(b[:i], enc(x, y, w, h)) if underX { xker.P6Decode(x, y, w, h, p[n:], b[i:]) } else { j := int(n) di, dj := int(colourdepth), col.P6 var c col.Colour for y := uint(0); y < h; y++ { for x := uint(0); x < w; x++ { col.Decode(&c, p[j:j+dj]) copy(b[i:i+di], cc(col.Code(c))) i += di j += dj } } } return b }
func (x *Imp) Decode(b []byte) { // x.class = Class(b[0]) i, a := uint(1), cluint x.number = Decode(uint(0), b[i:i+a]).(uint) i += a a = col.Codelen() col.Decode(&x.colour, b[i:i+a]) i += a a = x.vect.Codelen() x.vect.Decode(b[i : i+a]) i += a x.norm.Decode(b[i : i+a]) }
func P6Decode(x, y, w, h uint, p, b []byte) { // var c col.Colour i, j := uint(0), uint(0) di := uint(clz) for y := uint(0); y < h; y++ { for x := uint(0); x < w; x++ { col.Decode(&c, p[j:j+col.P6]) copy(b[i:i+di], obj.Encode(col.Code(c))) i += di j += col.P6 } } }
func (E *Imp) Colour() col.Colour { // B := stack[len(stack)-1] a := 0 E.origin.Decode(B[a : a+8]) a += 8 for d := D0; d < NDirs; d++ { E.vec[d].Decode(B[a : a+8]) a += 8 } var c col.Colour col.Decode(&c, B[a:a+3]) stack = stack[0 : len(stack)-2] return c }
func (f *Imp) Decode(B []byte) { // a := uint(0) f.sort = Sort(B[a]) a++ col.Decode(&f.colour, B[a:a+3]) a += 3 n := uint(0) n = Decode(uint(0), B[a:a+clz]).(uint) a += clz if f.sort < Text { f.x, f.y = make([]int, n), make([]int, n) for i := uint(0); i < n; i++ { f.x[i] = Decode(f.x[i], B[a:a+clz]).(int) a += clz f.y[i] = Decode(f.y[i], B[a:a+clz]).(int) a += clz } } else { // sort == Text, Image f.x, f.y = make([]int, 2), make([]int, 2) f.x[0] = Decode(f.x[0], B[a:a+clz]).(int) a += clz f.y[0] = Decode(f.y[0], B[a:a+clz]).(int) a += clz if f.sort == Image { f.x[1] = Decode(f.x[1], B[a:a+clz]).(int) a += clz f.y[1] = Decode(f.y[1], B[a:a+clz]).(int) a += clz } f.tx = string(B[a : a+n]) a += n if f.sort == Text { f.x[1] = f.x[0] + int(scr.NX1()*n) - 1 f.y[1] = f.y[0] + int(scr.NY1()) - 1 } } f.filled = B[a]%2 == 1 f.marked = (B[a]/2)%2 == 1 }