add more color examples

This commit is contained in:
vcaesar 2017-12-25 17:17:50 +08:00
parent 4f85eb5056
commit e0fb010ae1
3 changed files with 25 additions and 1 deletions

View File

@ -125,8 +125,20 @@ func screen() {
// gets the pixel color at 100, 200.
color := robotgo.GetPixelColor(100, 200)
fmt.Println("color----", color, "-----------------")
clo := robotgo.GetPxColor(100, 200)
fmt.Println("color...", clo)
clostr := robotgo.PadHex(clo)
fmt.Println("color...", clostr)
rgb := robotgo.RgbToHex(255, 100, 200)
rgbstr := robotgo.PadHex(robotgo.U32ToHex(rgb))
fmt.Println("rgb...", rgbstr)
hex := robotgo.HexToRgb(uint32(rgb))
fmt.Println("hex...", hex)
hexh := robotgo.PadHex(robotgo.U8ToHex(hex))
fmt.Println("HexToRgb...", hexh)
// gets the pixel color at 10, 20.
color2 := robotgo.GetPixelColor(10, 20)

View File

@ -38,8 +38,20 @@ func main() {
// gets the pixel color at 100, 200.
color := robotgo.GetPixelColor(100, 200)
fmt.Println("color----", color, "-----------------")
clo := robotgo.GetPxColor(100, 200)
fmt.Println("color...", clo)
clostr := robotgo.PadHex(clo)
fmt.Println("color...", clostr)
rgb := robotgo.RgbToHex(255, 100, 200)
rgbstr := robotgo.PadHex(robotgo.U32ToHex(rgb))
fmt.Println("rgb...", rgbstr)
hex := robotgo.HexToRgb(uint32(rgb))
fmt.Println("hex...", hex)
hexh := robotgo.PadHex(robotgo.U8ToHex(hex))
fmt.Println("HexToRgb...", hexh)
// gets the pixel color at 10, 20.
color2 := robotgo.GetPixelColor(10, 20)

View File

@ -34,7 +34,7 @@ char* pad_hex(MMRGBHex color){
static uint8_t rgb[3];
uint8_t *color_hex_to_rgb(uint32_t h){
uint8_t* color_hex_to_rgb(uint32_t h){
rgb[0] = RED_FROM_HEX(h);
rgb[1] = GREEN_FROM_HEX(h);
rgb[2] = BLUE_FROM_HEX(h);