Update: move type conversion to key.md and update godoc

This commit is contained in:
vcaesar 2023-03-11 08:51:29 -08:00
parent d249cdcd9e
commit cbca6d08c7
4 changed files with 31 additions and 27 deletions

View File

@ -29,7 +29,7 @@ RobotGo supports Mac, Windows, and Linux(X11); and robotgo supports arm64 and x8
- [Installation](#installation)
- [Update](#update)
- [Examples](#examples)
- [Type Conversion](#type-conversion)
- [Type Conversion and keys](https://github.com/go-vgo/robotgo/blob/master/docs/keys.md)
- [Cross-Compiling](#crosscompiling)
- [Authors](#authors)
- [Plans](#plans)
@ -488,28 +488,6 @@ func main() {
}
```
## Type Conversion
| | type conversion | func
|-----|---------------------|----------------------
| * | robotgo.Bitmap -> robotgo.CBitmap | robotgo.ToCBitmap()
| | robotgo.Bitmap -> *image.RGBA | robotgo.ToRGBAGo()
| * | robotgo.CBitmap -> C.MMBitmapRef | robotgo.ToMMBitmapRef()
| | robotgo.CBitmap -> robotgo.Bitmap | robotgo.ToBitmap()
| | robotgo.CBitmap -> image.Image | robotgo.ToImage()
| | robotgo.CBitmap -> *image.RGBA | robotgo.ToRGBA()
| * | C.MMBitmapRef -> robotgo.CBitmap | robotgo.CBitmap()
| * | image.Image -> robotgo.Bitmap | robotgo.ImgToBitmap()
| | image.Image -> robotgo.CBitmap | robotgo.ImgToCBitmap()
| | image.Image -> []byte | robotgo.ToByteImg()
| | image.Image -> string | robotgo.ToStringImg()
| * | *image.RGBA -> robotgo.Bitmap | robotgo.RGBAToBitmap()
| * | []byte -> image.Image | robotgo.ByteToImg()
| | []byte-> robotgo.CBitmap | robotgo.ByteToCBitmap()
| | []byte -> string | string()
| * | string -> image.Image | robotgo.StrToImg()
| | string -> byte | []byte()
## CrossCompiling
##### Windows64 to windows32

View File

@ -1,3 +1,25 @@
## Type Conversion
| | type conversion | func |
| --- | --------------------------------- | ----------------------- |
| \* | robotgo.Bitmap -> robotgo.CBitmap | robotgo.ToCBitmap() |
| | robotgo.Bitmap -> \*image.RGBA | robotgo.ToRGBAGo() |
| \* | robotgo.CBitmap -> C.MMBitmapRef | robotgo.ToMMBitmapRef() |
| | robotgo.CBitmap -> robotgo.Bitmap | robotgo.ToBitmap() |
| | robotgo.CBitmap -> image.Image | robotgo.ToImage() |
| | robotgo.CBitmap -> \*image.RGBA | robotgo.ToRGBA() |
| \* | C.MMBitmapRef -> robotgo.CBitmap | robotgo.CBitmap() |
| \* | image.Image -> robotgo.Bitmap | robotgo.ImgToBitmap() |
| | image.Image -> robotgo.CBitmap | robotgo.ImgToCBitmap() |
| | image.Image -> []byte | robotgo.ToByteImg() |
| | image.Image -> string | robotgo.ToStringImg() |
| \* | \*image.RGBA -> robotgo.Bitmap | robotgo.RGBAToBitmap() |
| \* | []byte -> image.Image | robotgo.ByteToImg() |
| | []byte-> robotgo.CBitmap | robotgo.ByteToCBitmap() |
| | []byte -> string | string() |
| \* | string -> image.Image | robotgo.StrToImg() |
| | string -> byte | []byte() |
# Keys
```Go
@ -118,4 +140,4 @@
"lights_kbd_toggle" Toggle keyboard backlight on/off No Windows support
"lights_kbd_up" Turn up keyboard backlight brightness No Windows support
"lights_kbd_down" Turn down keyboard backlight brightness No Windows support
```
```

4
key.go
View File

@ -482,7 +482,7 @@ func toErr(str *C.char) error {
// KeyTap taps the keyboard code;
//
// See keys:
// See keys supported:
//
// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
//
@ -613,7 +613,7 @@ func CharCodeAt(s string, n int) rune {
return 0
}
// UnicodeType tap uint32 unicode
// UnicodeType tap the uint32 unicode
func UnicodeType(str uint32, args ...int) {
cstr := C.uint(str)
pid := 0

View File

@ -88,7 +88,11 @@ type (
CBitmap C.MMBitmapRef
)
// Bitmap is Bitmap struct
// Bitmap define the go Bitmap struct
//
// The common type conversion of bitmap:
//
// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
type Bitmap struct {
ImgBuf *uint8
Width, Height int