Esempio n. 1
0
func Raw() (data []byte, width, height, stride int, err error) {
	C.Raw()
	// data = (*[1 << 30]byte)(unsafe.Pointer(C.Data()))[0:C.Length()]
	// newData := make([]byte, C.Length())
	// copy(newData, data)
	// C.Free()
	// return newData, int(C.width), int(C.height), int(C.stride), nil
	data = (*[1 << 30]byte)(unsafe.Pointer(C.Data()))[0:C.Length()]
	return data, int(C.width), int(C.height), int(C.stride), nil
}
// Screenshot returns an image.Image object containing the current screenshot.
// Currently we must.
func Screenshot() image.Image {
	C.Raw()
	defer C.Clean()

	width := int(C.Width)
	height := int(C.Height)
	stride := int(C.Stride)
	data := (*[1 << 30]byte)(unsafe.Pointer(C.data))[0 : height*stride]
	return ConvertWinBGRAToRGBA(width, height, stride, data)
}
Esempio n. 3
0
// Screenshot returns an image.Image object containing the current screenshot.
func Screenshot() image.Image {
	C.Raw()
	defer C.Clean()

	data := (*[1 << 30]byte)(unsafe.Pointer(C.Data()))[0:C.Length()]
	width := int(C.width)
	height := int(C.height)
	stride := int(C.stride)
	return ConvertMacBGRAToRGBA(width, height, stride, data)
}
Esempio n. 4
0
func Raw() (data []byte, width, height, stride int) {
	C.Raw()
	width = int(C.Width)
	height = int(C.Height)
	stride = int(C.Stride)
	fmt.Println(C.data)
	data = (*[1 << 30]byte)(unsafe.Pointer(C.data))[0 : height*stride]
	// data = nil
	return
}