add ToCBitmap example to examples

This commit is contained in:
vcaesar 2018-06-24 23:45:11 +08:00
parent 3dce490b76
commit fe836c3aae
3 changed files with 9 additions and 1 deletions

2
.gitignore vendored
View File

@ -9,6 +9,7 @@ examples/bitmap/test.png
examples/bitmap/test2.png
examples/bitmap/test.tif
examples/bitmap/test31.tif
examples/bitmap/tocbitmap.png
test/test.png
# Debug files
@ -66,4 +67,3 @@ _testmain.go
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

View File

@ -35,6 +35,10 @@ func main() {
gbit := robotgo.ToBitmap(bitmap)
fmt.Println("go bitmap", gbit, gbit.Width)
cbit := robotgo.ToCBitmap(gbit)
log.Println("cbit == bitmap: ", cbit == bitmap)
robotgo.SaveBitmap(cbit, "tocbitmap.png")
// find the color in bitmap
color := robotgo.GetColor(bitmap, 1, 2)
fmt.Println("color...", color)

View File

@ -178,6 +178,10 @@ func bitmap() {
gbit := robotgo.ToBitmap(bitmap)
fmt.Println("go bitmap", gbit, gbit.Width)
cbit := robotgo.ToCBitmap(gbit)
log.Println("cbit == bitmap: ", cbit == bitmap)
robotgo.SaveBitmap(cbit, "tocbtimap.png")
// find the color in bitmap
color := robotgo.GetColor(bitmap, 1, 2)
fmt.Println("color...", color)