tesseract  5.0.0
image.h
Go to the documentation of this file.
1 // File: image.h
3 // Description: Image wrapper.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 
16 #ifndef TESSERACT_CCSTRUCT_IMAGE_H_
17 #define TESSERACT_CCSTRUCT_IMAGE_H_
18 
19 #include <tesseract/export.h>
20 
21 struct Pix;
22 
23 namespace tesseract {
24 
25 class TESS_API Image {
26 public:
27  Pix *pix_ = nullptr;
28 
29 public:
30  Image() = default;
31  Image(Pix *pix) : pix_(pix) {}
32 
33  // service
34  bool operator==(decltype(nullptr)) const { return pix_ == nullptr; }
35  bool operator!=(decltype(nullptr)) const { return pix_ != nullptr; }
36  explicit operator bool() const { return pix_ != nullptr; }
37  operator Pix *() const { return pix_; }
38  explicit operator Pix **() { return &pix_; }
39  Pix *operator->() const { return pix_; }
40 
41  // api
42  Image clone() const; // increases refcount
43  Image copy() const; // does full copy
44  void destroy();
45  bool isZero() const;
46 
47  // ops
48  Image operator|(Image) const;
49  Image &operator|=(Image);
50  Image operator&(Image) const;
52 };
53 
54 } // namespace tesseract
55 
56 #endif // TESSERACT_CCSTRUCT_IMAGE_H_
TBOX & operator&=(TBOX &op1, const TBOX &op2)
Definition: rect.cpp:242
LIST destroy(LIST list)
Definition: oldlist.cpp:121
Pix * operator->() const
Definition: image.h:39
bool operator!=(decltype(nullptr)) const
Definition: image.h:35
bool operator==(decltype(nullptr)) const
Definition: image.h:34
Image(Pix *pix)
Definition: image.h:31
#define TESS_API
Definition: export.h:34