func dec(b []byte) (x, y, w, h uint) { // x = obj.Decode(uint(0), b[:clz]).(uint) y = obj.Decode(uint(0), b[1*clz:2*clz]).(uint) w = obj.Decode(uint(0), b[2*clz:3*clz]).(uint) h = obj.Decode(uint(0), b[3*clz:4*clz]).(uint) return }
func Decode(x, y, w, h uint, b []byte) { // const M = C.ulong(1<<32 - 1) ////////////////////////////////////////////////////////////////////////////////////////////// steals a lot of time ximg := C.XGetImage(display, C.Drawable(window), C.int(x), C.int(y), C.uint(w), C.uint(h), M, C.XYPixmap) ////////////////////////////////////////////////////////////////////////////////////////////// steals a lot of time n := uint(0) // var pixel C.ulong for j := uint(0); j < h; j++ { for i := uint(0); i < w; i++ { pixel := (C.ulong)(obj.Decode(n, b[n:n+4]).(uint)) C.xPutPixel(ximg, C.int(i), C.int(j), pixel) // C.XPutPixel (ximg, C.int(i), C.int(j), pixel) n += 4 } } C.XPutImage(display, C.Drawable(window), graphicsContext, ximg, 0, 0, C.int(x), C.int(y), C.uint(w), C.uint(h)) C.XCopyArea(display, C.Drawable(window), C.Drawable(pixmap), graphicsContext, C.int(x), C.int(y), C.uint(w), C.uint(h), C.int(x), C.int(y)) C.XFlush(display) C.xDestroyImage(ximg) // C.XDestroyImage (ximg) }
func Decode(b []byte) float64 { // return obj.Decode(0., b).(float64) // math.Float64frombits (obj.Decode (uint64(0), b).(uint64)) }