"Fossies" - the Fresh Open Source Software Archive

Member "tesseract-5.2.0/src/ccstruct/image.h" (6 Jul 2022, 1689 Bytes) of package /linux/misc/tesseract-5.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "image.h" see the Fossies "Dox" file reference documentation.

    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   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;
   51   Image &operator&=(Image);
   52 };
   53 
   54 } // namespace tesseract
   55 
   56 #endif // TESSERACT_CCSTRUCT_IMAGE_H_