Skip to content

Commit 1496eb9

Browse files
committed
add func RGB functions.
1 parent 5f1a99a commit 1496eb9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

winapi.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,19 @@ func BoolToBOOL(value bool) BOOL {
115115

116116
return 0
117117
}
118+
119+
func RGB(r, g, b byte) COLORREF {
120+
return COLORREF(r) | (COLORREF(g) << 8) | (COLORREF(b) << 16)
121+
}
122+
123+
func (p COLORREF) GetRValue() byte {
124+
return byte(p)
125+
}
126+
127+
func (p COLORREF) GetGValue() byte {
128+
return byte(p >> 8)
129+
}
130+
131+
func (p COLORREF) GetBValue() byte {
132+
return byte(p >> 16)
133+
}

0 commit comments

Comments
 (0)