reference/ocr-new/RLEPair.h
changeset 0 6b8091ca909a
equal deleted inserted replaced
-1:000000000000 0:6b8091ca909a
       
     1 #ifndef _RLEPair_H
       
     2 #define _RLEPair_H
       
     3 
       
     4 #include "list.h"
       
     5 
       
     6 
       
     7 // Indicates a series of black pixels in a row.
       
     8 class RLEPair {
       
     9 public:
       
    10 
       
    11   RLEPair()
       
    12     :start(0),end(0) {};
       
    13 
       
    14   RLEPair(int first, int last, int thisRow)
       
    15     :start(first), end(last), row(thisRow) {};
       
    16   RLEPair(int first, int last)
       
    17     :start(first), end(last), row(-1) {};
       
    18   ~RLEPair() {};
       
    19 
       
    20   short int start;
       
    21   short int end;
       
    22   short int row;
       
    23 };
       
    24 
       
    25 
       
    26 
       
    27 class RLEPairs :public List {
       
    28  public:
       
    29 
       
    30   RLEPairs(int row_num);
       
    31   ~RLEPairs();
       
    32 
       
    33   // Create RLEPair Representation of contents read from TIFF file
       
    34   void fill(unsigned char * contents, int contentsLength, int contentsRow);
       
    35   int pixelsBetween(int start, int end);
       
    36   int numPixels;
       
    37   void shift(int);
       
    38   void draw_pairs(char * window, double scaleFactor, 
       
    39 		  int y_coord, char* color, double width);
       
    40   void print_pairs();
       
    41   
       
    42   RLEPairs * extract(int startcol, int endcol);   
       
    43   // create a copy of this from  startcol to endcol.
       
    44  // and return pointer to RLEPairs
       
    45    
       
    46   void  merge(RLEPairs * pairs);
       
    47   // Merges  pairs into this.
       
    48 
       
    49   private:
       
    50     int row;
       
    51  
       
    52   
       
    53 };
       
    54 
       
    55 #endif
       
    56 
       
    57 
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 
       
    63 
       
    64 
       
    65 
       
    66 
       
    67 
       
    68 
       
    69