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 Restore(x, y, w, h uint) { // C.XCopyArea(display, C.Drawable(pixmap1), C.Drawable(window), graphicsContext, C.int(x), C.int(y), C.uint(w), C.uint(h), C.int(x), C.int(y)) 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)) }
func pp2ff() { // C.XCopyArea(display, C.Drawable(pixmap), C.Drawable(window), graphicsContext, 0, 0, xx, yy, 0, 0) C.XFlush(display) }