-
Notifications
You must be signed in to change notification settings - Fork 9
/
awbType.go
84 lines (76 loc) · 1.89 KB
/
awbType.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//Copyright (c) 2017, Technomancers. All rights reserved.
//Use of this source code is governed by a BSD-style
//license that can be found in the LICENSE file.
package piCamera
import (
"fmt"
)
//AWBType is for setting the Automatic White Balance setting.
type AWBType int
const (
//AwbAuto is for automatic white balance
AwbAuto AWBType = iota
//AwbOff is for turning automatic white balance off
AwbOff
//AwbSun is for sunny mode
AwbSun
//AwbCloud is for cloudy mode
AwbCloud
//AwbShade is for shade mode
AwbShade
//AwbTungsten tungsten lighting mode
AwbTungsten
//AwbFluorescent fluorescent lighting mode
AwbFluorescent
//AwbIncandescent incandescent lighting mode
AwbIncandescent
//AwbFlash flash mode
AwbFlash
//AwbHorizon horizon mode
AwbHorizon
)
//Convert takes the type and returns the string representation of that value.
//Returns true as well if it is the default value.
func (t AWBType) Convert() (string, bool) { //nolint: gocyclo
switch t {
case AwbAuto:
return "auto", true
case AwbOff:
return "off", false
case AwbSun:
return "sun", false
case AwbCloud:
return "cloud", false
case AwbShade:
return "shade", false
case AwbTungsten:
return "tungsten", false
case AwbFluorescent:
return "fluorescent", false
case AwbIncandescent:
return "incandescent", false
case AwbFlash:
return "flash", false
case AwbHorizon:
return "horizon", false
default:
return "", true
}
}
//AWBGains sets the blue and red gains to be applied when AWBOff is set.
type AWBGains struct {
b float32
r float32
}
//NewAWBGains creates gains to set to Red and Blue.
//Values are multiplied to the values so 1.5 is 150% and .5 is 50%.
func NewAWBGains(blue, red float32) *AWBGains {
return &AWBGains{
b: blue,
r: red,
}
}
//Convert takes the type and returns the string representation of that value.
func (t *AWBGains) Convert() string {
return fmt.Sprintf("%.2f,%.2f", t.b, t.r)
}