Update godoc

This commit is contained in:
vCaesar 2017-06-11 13:32:23 +08:00
parent 7f3b43e47d
commit a5173b5b54

View File

@ -79,7 +79,7 @@ type Bitmap struct {
BytesPerPixel uint8
}
// GetPixelColor Get pixel color
// GetPixelColor get pixel color
func GetPixelColor(x, y int) string {
cx := C.size_t(x)
cy := C.size_t(y)
@ -90,14 +90,14 @@ func GetPixelColor(x, y int) string {
return gcolor
}
// GetScreenSize Get screen size
// GetScreenSize get screen size
func GetScreenSize() (int, int) {
size := C.aGetScreenSize()
// fmt.Println("...", size, size.width)
return int(size.width), int(size.height)
}
// SetXDisplayName Set XDisplay name
// SetXDisplayName set XDisplay name
func SetXDisplayName(name string) string {
cname := C.CString(name)
str := C.aSetXDisplayName(cname)
@ -106,7 +106,7 @@ func SetXDisplayName(name string) string {
return gstr
}
// GetXDisplayName Get XDisplay name
// GetXDisplayName get XDisplay name
func GetXDisplayName() string {
name := C.aGetXDisplayName()
gname := C.GoString(name)
@ -114,7 +114,7 @@ func GetXDisplayName() string {
return gname
}
// CaptureScreen Capture the screen return bitmap(c struct)
// CaptureScreen capture the screen return bitmap(c struct)
func CaptureScreen(args ...int) C.MMBitmapRef {
var x C.size_t
var y C.size_t
@ -141,7 +141,7 @@ func CaptureScreen(args ...int) C.MMBitmapRef {
return bit
}
// BCaptureScreen Capture the screen and return bitmap(go struct)
// BCaptureScreen capture the screen and return bitmap(go struct)
func BCaptureScreen(args ...int) Bitmap {
var x C.size_t
var y C.size_t
@ -193,7 +193,7 @@ type MPoint struct {
y int
}
// MoveMouse Move the mouse
// MoveMouse move the mouse
func MoveMouse(x, y int) {
//C.size_t int
cx := C.size_t(x)
@ -201,28 +201,28 @@ func MoveMouse(x, y int) {
C.aMoveMouse(cx, cy)
}
// Move Move the mouse
// Move move the mouse
func Move(x, y int) {
cx := C.size_t(x)
cy := C.size_t(y)
C.aMoveMouse(cx, cy)
}
// DragMouse Drag the mouse
// DragMouse drag the mouse
func DragMouse(x, y int) {
cx := C.size_t(x)
cy := C.size_t(y)
C.aDragMouse(cx, cy)
}
// Drag Drag the mouse
// Drag drag the mouse
func Drag(x, y int) {
cx := C.size_t(x)
cy := C.size_t(y)
C.aDragMouse(cx, cy)
}
// MoveMouseSmooth Move the mouse smooth
// MoveMouseSmooth move the mouse smooth
func MoveMouseSmooth(x, y int, args ...float64) {
cx := C.size_t(x)
cy := C.size_t(y)
@ -244,7 +244,7 @@ func MoveMouseSmooth(x, y int, args ...float64) {
C.aMoveMouseSmooth(cx, cy, low, high)
}
// MoveSmooth Move the mouse smooth
// MoveSmooth move the mouse smooth
func MoveSmooth(x, y int, args ...float64) {
cx := C.size_t(x)
cy := C.size_t(y)
@ -266,7 +266,7 @@ func MoveSmooth(x, y int, args ...float64) {
C.aMoveMouseSmooth(cx, cy, low, high)
}
// GetMousePos Get mouse portion
// GetMousePos get mouse portion
func GetMousePos() (int, int) {
pos := C.aGetMousePos()
// fmt.Println("pos:###", pos, pos.x, pos.y)
@ -276,7 +276,7 @@ func GetMousePos() (int, int) {
return x, y
}
// MouseClick Click the mouse
// MouseClick click the mouse
func MouseClick(args ...interface{}) {
var button C.MMMouseButton
var double C.bool
@ -300,7 +300,7 @@ func MouseClick(args ...interface{}) {
C.aMouseClick(button, double)
}
// Click Click the mouse
// Click click the mouse
func Click(args ...interface{}) {
var button C.MMMouseButton
var double C.bool
@ -330,7 +330,7 @@ func MoveClick(x, y int, args ...interface{}) {
MouseClick(args)
}
// MouseToggle Toggle the mouse
// MouseToggle toggle the mouse
func MouseToggle(args ...interface{}) {
var button C.MMMouseButton
Try(func() {
@ -353,13 +353,13 @@ func MouseToggle(args ...interface{}) {
defer C.free(unsafe.Pointer(down))
}
// SetMouseDelay Set mouse delay
// SetMouseDelay set mouse delay
func SetMouseDelay(x int) {
cx := C.size_t(x)
C.aSetMouseDelay(cx)
}
// ScrollMouse Scroll the mouse
// ScrollMouse scroll the mouse
func ScrollMouse(x int, y string) {
cx := C.size_t(x)
z := C.CString(y)
@ -387,7 +387,7 @@ func Try(fun func(), handler func(interface{})) {
fun()
}
// KeyTap Tap the keyboard;
// KeyTap tap the keyboard;
//
// See keys:
// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
@ -447,7 +447,7 @@ func KeyTap(args ...interface{}) {
}
// KeyToggle Toggle the keyboard
// KeyToggle toggle the keyboard
//
// See keys:
// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
@ -491,14 +491,14 @@ func KeyToggle(args ...string) string {
return C.GoString(str)
}
// TypeString Type string
// TypeString type string
func TypeString(x string) {
cx := C.CString(x)
C.aTypeString(cx)
defer C.free(unsafe.Pointer(cx))
}
// TypeStrDelay Type string delayed
// TypeStrDelay type string delayed
func TypeStrDelay(x string, y int) {
cx := C.CString(x)
cy := C.size_t(y)
@ -506,7 +506,7 @@ func TypeStrDelay(x string, y int) {
defer C.free(unsafe.Pointer(cx))
}
// TypeStringDelayed Type string delayed, Wno-deprecated
// TypeStringDelayed type string delayed, Wno-deprecated
func TypeStringDelayed(x string, y int) {
cx := C.CString(x)
cy := C.size_t(y)
@ -514,12 +514,12 @@ func TypeStringDelayed(x string, y int) {
defer C.free(unsafe.Pointer(cx))
}
// SetKeyDelay Set keyboard delay
// SetKeyDelay set keyboard delay
func SetKeyDelay(x int) {
C.aSetKeyboardDelay(C.size_t(x))
}
// SetKeyboardDelay Set keyboard delay, Wno-deprecated
// SetKeyboardDelay set keyboard delay, Wno-deprecated
func SetKeyboardDelay(x int) {
C.aSetKeyboardDelay(C.size_t(x))
}
@ -533,7 +533,7 @@ func SetKeyboardDelay(x int) {
|______/ |__| |__| |__| |__| /__/ \__\ | _|
*/
// FindBitmap Find the bitmap
// FindBitmap find the bitmap
func FindBitmap(args ...interface{}) (int, int) {
var bit C.MMBitmapRef
bit = args[0].(C.MMBitmapRef)
@ -557,7 +557,7 @@ func FindBitmap(args ...interface{}) (int, int) {
return int(pos.x), int(pos.y)
}
// OpenBitmap Open the bitmap
// OpenBitmap open the bitmap
func OpenBitmap(args ...interface{}) C.MMBitmapRef {
path := C.CString(args[0].(string))
var mtype C.uint16_t
@ -574,7 +574,7 @@ func OpenBitmap(args ...interface{}) C.MMBitmapRef {
// defer C.free(unsafe.Pointer(path))
}
// SaveBitmap Save the bitmap
// SaveBitmap save the bitmap
func SaveBitmap(args ...interface{}) string {
var mtype C.uint16_t
Try(func() {
@ -601,7 +601,7 @@ func SaveBitmap(args ...interface{}) string {
// // defer C.free(unsafe.Pointer(path))
// }
// TostringBitmap Tostring bitmap
// TostringBitmap tostring bitmap
func TostringBitmap(bit C.MMBitmapRef) *C.char {
// str_bit := C.aTostringBitmap(bit)
strBit := C.aTostringBitmap(bit)
@ -610,7 +610,7 @@ func TostringBitmap(bit C.MMBitmapRef) *C.char {
return strBit
}
// GetPortion Get portion
// GetPortion get portion
func GetPortion(bit C.MMBitmapRef, x, y, w, h C.size_t) C.MMBitmapRef {
var rect C.MMRect
rect.origin.x = x
@ -622,7 +622,7 @@ func GetPortion(bit C.MMBitmapRef, x, y, w, h C.size_t) C.MMBitmapRef {
return pos
}
// Convert Convert bitmap
// Convert convert bitmap
func Convert(args ...interface{}) {
var mtype int
Try(func() {
@ -670,7 +670,7 @@ func CopyBitpb(bitmap C.MMBitmapRef) bool {
// Map a map
type Map map[string]interface{}
// AddEvent Add event listener
// AddEvent add event listener
func AddEvent(aeve string) int {
keycode := Map{
"f1": "59",
@ -705,12 +705,12 @@ func AddEvent(aeve string) int {
return geve
}
// StopEvent Stop event listener
// StopEvent stop event listener
func StopEvent() {
C.aStop()
}
// LEvent Add event listener, Wno-deprecated
// LEvent add event listener, Wno-deprecated
func LEvent(aeve string) int {
cs := C.CString(aeve)
eve := C.aEvent(cs)
@ -730,7 +730,7 @@ ____ __ ____ __ .__ __. _______ ______ ____ __ ____
*/
// ShowAlert Show a alert window
// ShowAlert show a alert window
func ShowAlert(title, msg string, args ...string) int {
var (
// title string
@ -762,7 +762,7 @@ func ShowAlert(title, msg string, args ...string) int {
return ibool
}
// IsValid Valid the window
// IsValid valid the window
func IsValid() bool {
abool := C.aIsValid()
gbool := bool(abool)
@ -770,30 +770,30 @@ func IsValid() bool {
return gbool
}
// SetActive Set the window active
// SetActive set the window active
func SetActive(win C.MData) {
C.aSetActive(win)
}
// GetActive Get the active window
// GetActive get the active window
func GetActive() C.MData {
mdata := C.aGetActive()
// fmt.Println("active----", mdata)
return mdata
}
// CloseWindow Close the window
// CloseWindow close the window
func CloseWindow() {
C.aCloseWindow()
}
// SetHandle Set the window handle
// SetHandle set the window handle
func SetHandle(hwnd int) {
chwnd := C.uintptr(hwnd)
C.aSetHandle(chwnd)
}
// GetHandle Get the window handle
// GetHandle get the window handle
func GetHandle() int {
hwnd := C.aGetHandle()
ghwnd := int(hwnd)
@ -801,7 +801,7 @@ func GetHandle() int {
return ghwnd
}
// GetBHandle Get the window handle
// GetBHandle get the window handle
func GetBHandle() int {
hwnd := C.bGetHandle()
ghwnd := int(hwnd)
@ -809,7 +809,7 @@ func GetBHandle() int {
return ghwnd
}
// GetTitle Get the window title
// GetTitle get the window title
func GetTitle() string {
title := C.aGetTitle()
gtittle := C.GoString(title)
@ -817,7 +817,7 @@ func GetTitle() string {
return gtittle
}
// GetPID Get the process id
// GetPID get the process id
func GetPID() int {
pid := C.aGetPID()
return int(pid)