Coverage Report

Created: 2025-07-23 07:12

/src/tesseract/src/ccstruct/image.h
Line
Count
Source (jump to first uncovered line)
1
///////////////////////////////////////////////////////////////////////
2
// 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.
14
///////////////////////////////////////////////////////////////////////
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
9.37M
  Image() = default;
31
16.1M
  Image(Pix *pix) : pix_(pix) {}
32
33
  // service
34
623k
  bool operator==(decltype(nullptr)) const { return pix_ == nullptr; }
35
5.73M
  bool operator!=(decltype(nullptr)) const { return pix_ != nullptr; }
36
34.5k
  explicit operator bool() const { return pix_ != nullptr; }
37
23.9M
  operator Pix *() const { return pix_; }
38
0
  explicit operator Pix **() { return &pix_; }
39
0
  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;
51
  Image &operator&=(Image);
52
};
53
54
} // namespace tesseract
55
56
#endif // TESSERACT_CCSTRUCT_IMAGE_H_