#define _MATCHERS_H |
#define _MATCHERS_H |
|
|
#include <vector> |
#include <vector> |
|
#include <set> |
/* Matchters */ |
/* Matchters */ |
#include "PatMatch.h" |
#include "PatMatch.h" |
#include "BitmapFont.h" |
#include "BitmapFont.h" |
PatMatch pm; |
PatMatch pm; |
public: |
public: |
MatchResult(int xx, int yy,PatMatch& p) :x(xx),y(yy),pm(p){} |
MatchResult(int xx, int yy,PatMatch& p) :x(xx),y(yy),pm(p){} |
|
vector<pixel> getPixels() const { |
|
return pm.getPixels(x,y); |
|
} |
}; |
}; |
|
|
class Matchers { |
class Matchers { |
} |
} |
bool coverCheck(const BitmapFont& bf){ |
bool coverCheck(const BitmapFont& bf){ |
vector<MatchResult> mr=findMatch(bf); |
vector<MatchResult> mr=findMatch(bf); |
vector<set<int> > pixel2match(bf.pixels.size()); |
vector<set<int> > pixel2match(bf.getSize()); |
vector<set<int> > match2pixel(mr.size()); |
vector<set<int> > match2pixel(mr.size()); |
vector<MatchResult>::iterator it; |
vector<MatchResult>::iterator it; |
for(it=mr.begin();it!=mr.end();it++){ |
for(it=mr.begin();it!=mr.end();it++){ |
int n= it-mr-begin(); |
int n= it-mr.begin(); |
set<pixel> ps; |
vector<pixel> ps=(*it).getPixels(); |
hogehoge |
vector<pixel>::iterator ips; |
match2pixel[n].swap(ps); |
for(ips=ps.begin();ips!=ps.end();ips++){ |
|
int m=bf.getIndex(*ips); |
|
assert(m != -1); |
|
match2pixel[n].insert(m); |
|
pixel2match[m].insert(n); |
|
} |
|
} |
|
for(int i=0;i<bf.getPixelSize();i++){ |
|
if(pixel2match[i].empty()) return false; |
} |
} |
return true; |
return true; |
} |
} |