Example #1
0
File: gmdgo.go Project: waxcorp/gmd
func (w *Window) Screen() (im draw.Image) {
	width, height := w.Size()
	ci := C.getWindowScreen(w.cw)
	gim := &Image{
		width:  width,
		height: height,
		data:   make([]byte, 4*width*height),
		ci:     ci,
	}

	ptr := unsafe.Pointer(&gim.data[0])

	C.setScreenData(ci, ptr)
	w.im = gim
	im = gim
	return
}
Example #2
0
func (w *Window) resizeBuffer(width, height int) (im wde.Image) {
	onMainThread(func() {
		ci := C.getWindowScreen(w.cw)

		w.im = Image{image.NewRGBA(image.Rectangle{
			image.Point{},
			image.Point{width, height},
		})}

		ptr := unsafe.Pointer(&w.im.Pix[0])

		C.setScreenData(ci, ptr)

		im = w.im
	})
	return
}
Example #3
0
func (w *Window) resizeBuffer(width, height int) (im draw.Image) {
	w.oplock.Lock()
	defer w.oplock.Unlock()

	ci := C.getWindowScreen(w.cw)

	w.im = image.NewRGBA(image.Rectangle{
		image.Point{},
		image.Point{width, height},
	})

	ptr := unsafe.Pointer(&w.im.Pix[0])

	C.setScreenData(ci, ptr)

	im = w.im
	return
}