-
Notifications
You must be signed in to change notification settings - Fork 13
/
color_windows.go
53 lines (44 loc) · 1.85 KB
/
color_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package d3d9
// COLOR represents a color with red, green, blue and alpha channels, 8 bits
// each, in a 32 bit unsinged integer.
type COLOR uint32
// ColorARGB converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorARGB(a, r, g, b uint8) COLOR {
return COLOR(a)<<24 | COLOR(r)<<16 | COLOR(g)<<8 | COLOR(b)
}
// ColorRGBA converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorRGBA(r, g, b, a uint8) COLOR {
return ColorARGB(a, r, g, b)
}
// ColorXRGB converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorXRGB(r, g, b uint8) COLOR {
return ColorARGB(0xFF, r, g, b)
}
// ColorRGB converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorRGB(r, g, b uint8) COLOR {
return ColorARGB(0xFF, r, g, b)
}
// ColorXYUV converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorXYUV(y, u, v uint8) COLOR {
return ColorARGB(0xFF, y, u, v)
}
// ColorYUV converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorYUV(y, u, v uint8) COLOR {
return ColorARGB(0xFF, y, u, v)
}
// ColorAYUV converts the given color channel values to a color. Each channel
// ranges from 0 (no intensity) to 255 (full intensity).
func ColorAYUV(a, y, u, v uint8) COLOR {
return ColorARGB(a, y, u, v)
}
// ColorValue converts the given color channel values to a color. Each channel
// ranges from 0.0 (no intensity) to 1.0 (full intensity).
func ColorValue(r, g, b, a float32) COLOR {
return ColorARGB(uint8(a*255), uint8(r*255), uint8(g*255), uint8(b*255))
}