Skip to content

Commit

Permalink
Update: move type conversion to key.md and update godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Mar 11, 2023
1 parent d249cdc commit cbca6d0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
24 changes: 1 addition & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
24 changes: 23 additions & 1 deletion docs/keys.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 changes: 2 additions & 2 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion robotgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cbca6d0

Please sign in to comment.