1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_widget_nsTextRecognition__
6 #define mozilla_widget_nsTextRecognition__
8 #include "mozilla/MozPromise.h"
9 #include "mozilla/gfx/Point.h"
17 class TextRecognitionResultOrError
;
18 class TextRecognitionResult
;
23 class DataSourceSurface
;
28 class TextRecognition final
{
30 using NativePromise
= MozPromise
<dom::TextRecognitionResult
, nsCString
,
31 /* IsExclusive = */ true>;
33 TextRecognition() = default;
35 static void FillShadow(dom::ShadowRoot
&, const dom::TextRecognitionResult
&);
37 static RefPtr
<NativePromise
> FindText(imgIContainer
&,
38 const nsTArray
<nsCString
>&);
39 static RefPtr
<NativePromise
> FindText(gfx::DataSourceSurface
&,
40 const nsTArray
<nsCString
>&);
41 static bool IsSupported();
44 // This should be implemented in the OS specific file.
45 static RefPtr
<NativePromise
> DoFindText(gfx::DataSourceSurface
&,
46 const nsTArray
<nsCString
>&);
48 ~TextRecognition() = default;
52 } // namespace mozilla