@@ -982,6 +982,7 @@ var (
982
982
getEnhMetaFile uintptr
983
983
getEnhMetaFileHeader uintptr
984
984
getObject uintptr
985
+ getPixel uintptr
985
986
getStockObject uintptr
986
987
getTextExtentExPoint uintptr
987
988
getTextExtentPoint32 uintptr
@@ -995,6 +996,7 @@ var (
995
996
selectObject uintptr
996
997
setBkMode uintptr
997
998
setBrushOrgEx uintptr
999
+ setPixel uintptr
998
1000
setPixelFormat uintptr
999
1001
setStretchBltMode uintptr
1000
1002
setTextColor uintptr
@@ -1035,6 +1037,7 @@ func init() {
1035
1037
getEnhMetaFile = MustGetProcAddress (libgdi32 , "GetEnhMetaFileW" )
1036
1038
getEnhMetaFileHeader = MustGetProcAddress (libgdi32 , "GetEnhMetaFileHeader" )
1037
1039
getObject = MustGetProcAddress (libgdi32 , "GetObjectW" )
1040
+ getPixel = MustGetProcAddress (libgdi32 , "GetPixel" )
1038
1041
getStockObject = MustGetProcAddress (libgdi32 , "GetStockObject" )
1039
1042
getTextExtentExPoint = MustGetProcAddress (libgdi32 , "GetTextExtentExPointW" )
1040
1043
getTextExtentPoint32 = MustGetProcAddress (libgdi32 , "GetTextExtentPoint32W" )
@@ -1049,6 +1052,7 @@ func init() {
1049
1052
selectObject = MustGetProcAddress (libgdi32 , "SelectObject" )
1050
1053
setBkMode = MustGetProcAddress (libgdi32 , "SetBkMode" )
1051
1054
setBrushOrgEx = MustGetProcAddress (libgdi32 , "SetBrushOrgEx" )
1055
+ setPixel = MustGetProcAddress (libgdi32 , "SetPixel" )
1052
1056
setPixelFormat = MustGetProcAddress (libgdi32 , "SetPixelFormat" )
1053
1057
setStretchBltMode = MustGetProcAddress (libgdi32 , "SetStretchBltMode" )
1054
1058
setTextColor = MustGetProcAddress (libgdi32 , "SetTextColor" )
@@ -1303,6 +1307,15 @@ func GetObject(hgdiobj HGDIOBJ, cbBuffer uintptr, lpvObject unsafe.Pointer) int3
1303
1307
return int32 (ret )
1304
1308
}
1305
1309
1310
+ func GetPixel (hdc HDC , nXPos , nYPos int32 ) COLORREF {
1311
+ ret , _ , _ := syscall .Syscall (getPixel , 3 ,
1312
+ uintptr (hdc ),
1313
+ uintptr (nXPos ),
1314
+ uintptr (nYPos ))
1315
+
1316
+ return COLORREF (ret )
1317
+ }
1318
+
1306
1319
func GetStockObject (fnObject int32 ) HGDIOBJ {
1307
1320
ret , _ , _ := syscall .Syscall (getDeviceCaps , 1 ,
1308
1321
uintptr (fnObject ),
@@ -1445,6 +1458,18 @@ func SetBrushOrgEx(hdc HDC, nXOrg, nYOrg int32, lppt *POINT) bool {
1445
1458
return ret != 0
1446
1459
}
1447
1460
1461
+ func SetPixel (hdc HDC , X , Y int32 , crColor COLORREF ) COLORREF {
1462
+ ret , _ , _ := syscall .Syscall6 (setPixel , 4 ,
1463
+ uintptr (hdc ),
1464
+ uintptr (X ),
1465
+ uintptr (Y ),
1466
+ uintptr (crColor ),
1467
+ 0 ,
1468
+ 0 )
1469
+
1470
+ return COLORREF (ret )
1471
+ }
1472
+
1448
1473
func SetPixelFormat (hdc HDC , iPixelFormat int32 , ppfd * PIXELFORMATDESCRIPTOR ) bool {
1449
1474
ret , _ , _ := syscall .Syscall (setPixelFormat , 3 ,
1450
1475
uintptr (hdc ),
0 commit comments