44
55namespace winrt ::ReactNativeCameraCPP
66{
7- static const int CameraAspectFill = 0 ;
8- static const int CameraAspectFit = 1 ;
9- static const int CameraAspectStretch = 2 ;
10- static const int CameraCaptureTargetMemory = 0 ;
11- static const int CameraCaptureTargetDisk = 1 ;
12- static const int CameraCaptureTargetCameraRoll = 2 ;
13- static const int CameraCaptureTargetTemp = 3 ;
14- static const int CameraOrientationAuto = UINT_MAX;
15- static const int CameraOrientationPortrait = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::NotRotated;
16- static const int CameraOrientationPortraitUpsideDown = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated180DegreesCounterclockwise;
17- static const int CameraOrientationLandscapeLeft = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated90DegreesCounterclockwise;
18- static const int CameraOrientationLandscapeRight = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated270DegreesCounterclockwise;
19- static const int CameraTypeFront = (int )winrt::Windows::Devices::Enumeration::Panel::Front;
20- static const int CameraTypeBack = (int )winrt::Windows::Devices::Enumeration::Panel::Back;
21- static const int CameraFlashModeOff = 0 ;
22- static const int CameraFlashModeOn = 1 ;
23- static const int CameraFlashModeAuto = 2 ;
24- static const int CameraTorchModeOff = 0 ;
25- static const int CameraTorchModeOn = 1 ;
26- static const int CameraTorchModeAuto = 2 ;
27- static const int CameraAutoFocusOff = 0 ;
28- static const int CameraAutoFocusOn = 1 ;
29- static const int CameraWhiteBalanceAuto = 0 ;
30- static const int CameraWhiteBalanceSunny = 1 ;
31- static const int CameraWhiteBalanceCloudy = 2 ;
32- static const int CameraWhiteBalanceShadow = 3 ;
33- static const int CameraWhiteBalanceIncandescent = 4 ;
34- static const int CameraWhiteBalanceFluorescent = 5 ;
35- static const int CameraCaptureQualityHigh = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
36- static const int CameraCaptureQualityLow = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
37- static const int CameraCaptureQuality1080p = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
38- static const int CameraCaptureQuality720p = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
39- static const int MediaTypeImage = 1 ;
40- static const int MediaTypeVideo = 2 ;
7+ class ReactCameraContants
8+ {
9+ public:
10+ static const int CameraAspectFill = 0 ;
11+ static const int CameraAspectFit = 1 ;
12+ static const int CameraAspectStretch = 2 ;
13+ static const int CameraCaptureTargetMemory = 0 ;
14+ static const int CameraCaptureTargetDisk = 1 ;
15+ static const int CameraCaptureTargetCameraRoll = 2 ;
16+ static const int CameraCaptureTargetTemp = 3 ;
17+ static const int CameraOrientationAuto = UINT_MAX;
18+ static const int CameraOrientationPortrait = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::NotRotated;
19+ static const int CameraOrientationPortraitUpsideDown = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated180DegreesCounterclockwise;
20+ static const int CameraOrientationLandscapeLeft = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated90DegreesCounterclockwise;
21+ static const int CameraOrientationLandscapeRight = (int )winrt::Windows::Devices::Sensors::SimpleOrientation::Rotated270DegreesCounterclockwise;
22+ static const int CameraTypeFront = (int )winrt::Windows::Devices::Enumeration::Panel::Front;
23+ static const int CameraTypeBack = (int )winrt::Windows::Devices::Enumeration::Panel::Back;
24+ static const int CameraFlashModeOff = 0 ;
25+ static const int CameraFlashModeOn = 1 ;
26+ static const int CameraFlashModeAuto = 2 ;
27+ static const int CameraTorchModeOff = 0 ;
28+ static const int CameraTorchModeOn = 1 ;
29+ static const int CameraTorchModeAuto = 2 ;
30+ static const int CameraAutoFocusOff = 0 ;
31+ static const int CameraAutoFocusOn = 1 ;
32+ static const int CameraWhiteBalanceAuto = 0 ;
33+ static const int CameraWhiteBalanceSunny = 1 ;
34+ static const int CameraWhiteBalanceCloudy = 2 ;
35+ static const int CameraWhiteBalanceShadow = 3 ;
36+ static const int CameraWhiteBalanceIncandescent = 4 ;
37+ static const int CameraWhiteBalanceFluorescent = 5 ;
38+ static const int CameraCaptureQualityHigh = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
39+ static const int CameraCaptureQualityLow = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
40+ static const int CameraCaptureQuality1080p = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD1080p;
41+ static const int CameraCaptureQuality720p = (int )winrt::Windows::Media::MediaProperties::VideoEncodingQuality::HD720p;
42+ static const int MediaTypeImage = 1 ;
43+ static const int MediaTypeVideo = 2 ;
4144
42- #pragma warning( push )
43- #pragma warning( disable : 4505 )
44- static std::map<std::wstring, int > GetAspectConstants () noexcept {
45- return std::map<std::wstring, int >
46- {
47- { L" stretch" , CameraAspectStretch },
48- { L" fit" , CameraAspectFit },
49- { L" fill" , CameraAspectFill }
50- };
51- }
45+ static std::map<std::wstring, int > GetAspectConstants () noexcept {
46+ return std::map<std::wstring, int >
47+ {
48+ { L" stretch" , CameraAspectStretch },
49+ { L" fit" , CameraAspectFit },
50+ { L" fill" , CameraAspectFill }
51+ };
52+ }
5253
53- static std::map<std::wstring, std::wstring> GetBarcodeConstants () noexcept {
54- return std::map<std::wstring, std::wstring>
55- {
56- { L" UPC_E" , L" 32768" },
57- { L" CODE_39" , L" 4" },
58- };
59- }
54+ static std::map<std::wstring, std::wstring> GetBarcodeConstants () noexcept {
55+ return std::map<std::wstring, std::wstring>
56+ {
57+ { L" UPC_E" , L" 32768" },
58+ { L" CODE_39" , L" 4" },
59+ };
60+ }
6061
61- static std::map<std::wstring, int > GetAutoFocusConstants () noexcept {
62- return std::map<std::wstring, int >
63- {
64- { L" off" , CameraAutoFocusOff },
65- { L" on" , CameraAutoFocusOn },
66- };
67- }
62+ static std::map<std::wstring, int > GetAutoFocusConstants () noexcept {
63+ return std::map<std::wstring, int >
64+ {
65+ { L" off" , CameraAutoFocusOff },
66+ { L" on" , CameraAutoFocusOn },
67+ };
68+ }
6869
69- static std::map<std::wstring, int > GetWhiteBalanceConstants () noexcept {
70- return std::map<std::wstring, int >
71- {
72- { L" auto" , CameraWhiteBalanceAuto },
73- { L" sunny" , CameraWhiteBalanceSunny },
74- { L" cloudy" , CameraWhiteBalanceCloudy },
75- { L" shadow" , CameraWhiteBalanceShadow },
76- { L" incandescent" , CameraWhiteBalanceIncandescent },
77- { L" fluorescent" , CameraWhiteBalanceFluorescent },
78- };
79- }
70+ static std::map<std::wstring, int > GetWhiteBalanceConstants () noexcept {
71+ return std::map<std::wstring, int >
72+ {
73+ { L" auto" , CameraWhiteBalanceAuto },
74+ { L" sunny" , CameraWhiteBalanceSunny },
75+ { L" cloudy" , CameraWhiteBalanceCloudy },
76+ { L" shadow" , CameraWhiteBalanceShadow },
77+ { L" incandescent" , CameraWhiteBalanceIncandescent },
78+ { L" fluorescent" , CameraWhiteBalanceFluorescent },
79+ };
80+ }
8081
81- static std::map<std::wstring, int > GetTypeConstants () noexcept {
82- return std::map<std::wstring, int >
83- {
84- { L" front" , CameraTypeFront },
85- { L" back" , CameraTypeBack },
86- };
87- }
82+ static std::map<std::wstring, int > GetTypeConstants () noexcept {
83+ return std::map<std::wstring, int >
84+ {
85+ { L" front" , CameraTypeFront },
86+ { L" back" , CameraTypeBack },
87+ };
88+ }
8889
89- static std::map<std::wstring, int > GetCaptureQualityConstants () noexcept {
90- return std::map<std::wstring, int >
91- {
92- { L" low" , CameraCaptureQualityLow },
93- { L" high" , CameraCaptureQualityHigh },
94- { L" 720p" , CameraCaptureQuality720p },
95- { L" 1080p" , CameraCaptureQuality1080p },
96- };
97- }
90+ static std::map<std::wstring, int > GetCaptureQualityConstants () noexcept {
91+ return std::map<std::wstring, int >
92+ {
93+ { L" low" , CameraCaptureQualityLow },
94+ { L" high" , CameraCaptureQualityHigh },
95+ { L" 720p" , CameraCaptureQuality720p },
96+ { L" 1080p" , CameraCaptureQuality1080p },
97+ };
98+ }
9899
99- static std::map<std::wstring, int > GetCaptureTargetConstants () noexcept {
100- return std::map<std::wstring, int >
101- {
102- { L" memory" , CameraCaptureTargetMemory },
103- { L" disk" , CameraCaptureTargetDisk },
104- { L" cameraRoll" , CameraCaptureTargetCameraRoll },
105- { L" temp" , CameraCaptureTargetTemp },
106- };
107- }
100+ static std::map<std::wstring, int > GetCaptureTargetConstants () noexcept {
101+ return std::map<std::wstring, int >
102+ {
103+ { L" memory" , CameraCaptureTargetMemory },
104+ { L" disk" , CameraCaptureTargetDisk },
105+ { L" cameraRoll" , CameraCaptureTargetCameraRoll },
106+ { L" temp" , CameraCaptureTargetTemp },
107+ };
108+ }
108109
109- static std::map<std::wstring, int > GetOrientationConstants () noexcept {
110- return std::map<std::wstring, int >
111- {
112- { L" auto" , CameraOrientationAuto },
113- { L" landscapeLeft" , CameraOrientationLandscapeLeft },
114- { L" landscapeRight" , CameraOrientationLandscapeRight },
115- { L" portrait" , CameraOrientationPortrait },
116- { L" portraitUpsideDown" , CameraOrientationPortraitUpsideDown },
117- };
118- }
110+ static std::map<std::wstring, int > GetOrientationConstants () noexcept {
111+ return std::map<std::wstring, int >
112+ {
113+ { L" auto" , CameraOrientationAuto },
114+ { L" landscapeLeft" , CameraOrientationLandscapeLeft },
115+ { L" landscapeRight" , CameraOrientationLandscapeRight },
116+ { L" portrait" , CameraOrientationPortrait },
117+ { L" portraitUpsideDown" , CameraOrientationPortraitUpsideDown },
118+ };
119+ }
119120
120- static std::map<std::wstring, int > GetFlashModeConstants () noexcept {
121- return std::map<std::wstring, int >
122- {
123- { L" off" , CameraFlashModeOff },
124- { L" on" , CameraFlashModeOn },
125- { L" auto" , CameraOrientationAuto },
126- };
127- }
128-
129- static std::map<std::wstring, int > GetTorchModeConstants () noexcept {
130- return std::map<std::wstring, int >
131- {
132- { L" off" , CameraTorchModeOff },
133- { L" on" , CameraTorchModeOn },
134- { L" auto" , CameraTorchModeAuto },
135- };
136- }
137-
138- #pragma warning( pop )
121+ static std::map<std::wstring, int > GetFlashModeConstants () noexcept {
122+ return std::map<std::wstring, int >
123+ {
124+ { L" off" , CameraFlashModeOff },
125+ { L" on" , CameraFlashModeOn },
126+ { L" auto" , CameraOrientationAuto },
127+ };
128+ }
139129
130+ static std::map<std::wstring, int > GetTorchModeConstants () noexcept {
131+ return std::map<std::wstring, int >
132+ {
133+ { L" off" , CameraTorchModeOff },
134+ { L" on" , CameraTorchModeOn },
135+ { L" auto" , CameraTorchModeAuto },
136+ };
137+ }
138+ };
140139};
0 commit comments