Exemplo n.º 1
0
Arquivo: gmdgo.go Projeto: 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
}
Exemplo n.º 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
}
Exemplo n.º 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
}