#ifndef _BITMAP_H #define _BITMAP_H #include "system.h" /** A BitMap representation stores image in an array of unsigned character arrays. There is one uchar array per row. Each bit of the uchar represents a pixel. ***/ class RLEMap; class Point; class BitMap; extern void byteprint(char d); extern void bitprint(char d, int x); class BitMap{ public: friend MapStatus convertMap(RLEMap *,BitMap*,Point,Point); friend MapStatus convertMap(BitMap *,RLEMap*,Point,Point); BitMap(); ~BitMap(); int & imageLength() {return fImageLength;}; int & imageWidth() {return fImageWidth;}; readBit(Point p); MapStatus & status() {return fStatus; }; uchar * row(int i); // returns a pointer to row i // I/O operations. readMap and writeMap are from/to 2 level TIFF files MapStatus readMap(char * filename); MapStatus writeMap(char * filename); // not done // Write out BitMap format for TCL/TK display MapStatus writeTclMap(char * filename, Point ul, Point lr, int scaledown); // Detect skew Angle Angle skewAngle(); //Rotate the map designated angle. MapStatus rotateMap(Angle angl); // Return a ratio of black pixels to white pixels // scaled to 255 0 = all white 255=all black short int grayScale(Point ul, Point lr); // number of black pixels in bounding box const int BitMap::pixelsInRegion( Point ul, Point lr); int BitMap::minThickness(Point ul, Point lr); private: int fImageWidth; int fImageLength; MapStatus fStatus; uchar ** fMapData; } ; #endif