From cbca6d08c719a7466756b40c220edf0132025f50 Mon Sep 17 00:00:00 2001
From: vcaesar <vzvway@gmail.com>
Date: Sat, 11 Mar 2023 08:51:29 -0800
Subject: [PATCH] Update: move type conversion to key.md and update godoc

---
 README.md    | 24 +-----------------------
 docs/keys.md | 24 +++++++++++++++++++++++-
 key.go       |  4 ++--
 robotgo.go   |  6 +++++-
 4 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/README.md b/README.md
index ce14fb1..d608c4e 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/docs/keys.md b/docs/keys.md
index dff9e22..cedc4fd 100644
--- a/docs/keys.md
+++ b/docs/keys.md
@@ -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
-```
\ No newline at end of file
+```
diff --git a/key.go b/key.go
index 3cfd588..15e85e6 100644
--- a/key.go
+++ b/key.go
@@ -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
diff --git a/robotgo.go b/robotgo.go
index 505ee6f..4c97069 100644
--- a/robotgo.go
+++ b/robotgo.go
@@ -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