mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update bitmap example code
This commit is contained in:
parent
18116eb94b
commit
ef847f3613
@ -53,17 +53,9 @@ func findColor(bmp robotgo.CBitmap) {
|
|||||||
fmt.Println("count...", cnt1)
|
fmt.Println("count...", cnt1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func bitmapTool(bmp robotgo.CBitmap) {
|
func bitmapString(bmp robotgo.CBitmap) {
|
||||||
bitmap := robotgo.ToMMBitmapRef(bmp)
|
bitmap := robotgo.ToMMBitmapRef(bmp)
|
||||||
|
|
||||||
// bitmap := robotgo.CaptureScreen(10, 20, 30, 40)
|
|
||||||
abool := robotgo.PointInBounds(bitmap, 1, 2)
|
|
||||||
fmt.Println("point in bounds...", abool)
|
|
||||||
|
|
||||||
// returns new bitmap object created from a portion of another
|
|
||||||
bitpos := robotgo.GetPortion(bitmap, 10, 10, 11, 10)
|
|
||||||
fmt.Println(bitpos)
|
|
||||||
|
|
||||||
// creates bitmap from string by bitmap
|
// creates bitmap from string by bitmap
|
||||||
bitstr := robotgo.TostringBitmap(bitmap)
|
bitstr := robotgo.TostringBitmap(bitmap)
|
||||||
fmt.Println("bitstr...", bitstr)
|
fmt.Println("bitstr...", bitstr)
|
||||||
@ -73,6 +65,18 @@ func bitmapTool(bmp robotgo.CBitmap) {
|
|||||||
sbitmap := robotgo.BitmapStr(bitstr)
|
sbitmap := robotgo.BitmapStr(bitstr)
|
||||||
fmt.Println("bitmap str...", sbitmap)
|
fmt.Println("bitmap str...", sbitmap)
|
||||||
robotgo.SaveBitmap(sbitmap, "teststr.png")
|
robotgo.SaveBitmap(sbitmap, "teststr.png")
|
||||||
|
}
|
||||||
|
|
||||||
|
func bitmapTool(bmp robotgo.CBitmap) {
|
||||||
|
bitmap := robotgo.ToMMBitmapRef(bmp)
|
||||||
|
|
||||||
|
// bitmap := robotgo.CaptureScreen(10, 20, 30, 40)
|
||||||
|
abool := robotgo.PointInBounds(bitmap, 1, 2)
|
||||||
|
fmt.Println("point in bounds...", abool)
|
||||||
|
|
||||||
|
// returns new bitmap object created from a portion of another
|
||||||
|
bitpos := robotgo.GetPortion(bitmap, 10, 10, 11, 10)
|
||||||
|
fmt.Println(bitpos)
|
||||||
|
|
||||||
// saves image to absolute filepath in the given format
|
// saves image to absolute filepath in the given format
|
||||||
robotgo.SaveBitmap(bitmap, "test.png")
|
robotgo.SaveBitmap(bitmap, "test.png")
|
||||||
@ -141,6 +145,7 @@ func bitmap() {
|
|||||||
bitmapTest(cbit)
|
bitmapTest(cbit)
|
||||||
findBitmap(cbit)
|
findBitmap(cbit)
|
||||||
|
|
||||||
|
bitmapString(cbit)
|
||||||
bitmapTool(cbit)
|
bitmapTool(cbit)
|
||||||
|
|
||||||
decode()
|
decode()
|
||||||
|
Loading…
Reference in New Issue
Block a user