1 # ifndef BM_SEGMENTS_H 2 # define BM_SEGMENTS_H 3 4 # include "bitmap.h" 5 6 typedef struct DataRun 7 { 8 short int drX0; 9 short int drXp; 10 short int drRepeatCount; 11 } DataRun; 12 13 typedef struct SegmentEdge 14 { 15 struct SegmentNode * seFrom; 16 struct SegmentNode * seTo; 17 DataRun * seRuns; 18 short int seRunCount; 19 } SegmentEdge; 20 21 typedef struct SegmentNode 22 { 23 SegmentEdge ** snUpEdges; 24 SegmentEdge ** snDownEdges; 25 short int snUpEdgeCount; 26 short int snDownEdgeCount; 27 short int snY0; 28 } SegmentNode; 29 30 /************************************************************************/ 31 /* */ 32 /* A 'segment' as discovered during the segmentation process. */ 33 /* */ 34 /* NOTE that conceptually there is a similarity with the graph */ 35 /* resulting from the skeleton of a component. In this */ 36 /* implementation, the is no relationship however. */ 37 /* */ 38 /************************************************************************/ 39 40 typedef struct BitmapSegment 41 { 42 DocumentRectangle bsRect; 43 short int bsNodeCount; 44 short int bsEdgeCount; 45 SegmentNode ** bsNodes; 46 SegmentEdge ** bsEdges; 47 } BitmapSegment; 48 49 /************************************************************************/ 50 /* */ 51 /* Routine declarations. */ 52 /* */ 53 /************************************************************************/ 54 55 extern int bcComponents( BitmapSegment *** pSegments, 56 int * pCount, 57 const unsigned char * buffer, 58 const BitmapDescription * bd ); 59 60 extern void bmFreeSegment( BitmapSegment * bs ); 61 62 extern int bmcDrawComponent( const BitmapSegment * bs, 63 unsigned char * buffer, 64 int col0, 65 int row0, 66 int bytesPerRow, 67 int colorEncoding ); 68 69 extern void bmcStatistics( const BitmapSegment * bs, 70 int * pN, 71 float * pSx, 72 float * pSy, 73 float * pSxx, 74 float * pSyy, 75 float * pSxy ); 76 77 # endif /* BM_SEGMENTS_H */ 78