[wadalabfont-kit] / jis2prim / PatMatch.h  

View of /jis2prim/PatMatch.h

Parent Directory | Revision Log
Revision: 1.1 - (download) (as text) (annotate)
Thu Feb 21 11:57:39 2002 UTC (22 years, 3 months ago) by ktanaka
Branch: MAIN
*** empty log message ***
#include <string>
#include "BitmapFont.h"
#include "Assumption.h"

/* @ : 黒 */
/* . : 白 */
/* else(?) : どちらでも */
class PatMatch{
 private:
  int width, height;
  string pat;
  Assumption assumption;
 public:
  PatMatch(int w,int h,string s,Assumption as) 
    :width(w), height(h), pat(s), assumption(as){
    assert(pat.length() == (unsigned int)width*height);
  }
  bool isMatch(const BitmapFont& bf, int x, int y) const{
    for(int i=0;i<width;i++)
      for(int j=0;j<height;j++){
	if(bf.get(x+i,y+j)){
	  if(pat[j*width+i]=='.') return false;
	}
	else if(pat[j*width+i]=='@') return false;
      }
    return true;
  }
};

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help