mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13:55 +00:00
add more color examples
This commit is contained in:
parent
4f85eb5056
commit
e0fb010ae1
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user