Revision Log
Revision: 1.6 - (view) (download) (as text)
| 1 : | ktanaka | 1.1 | #ifndef _BITMAP_FONT_H |
| 2 : | #define _BITMAP_FONT_H | ||
| 3 : | |||
| 4 : | #include <vector> | ||
| 5 : | #include <string> | ||
| 6 : | ktanaka | 1.2 | #include <algorithm> |
| 7 : | ktanaka | 1.5 | #include <cassert> |
| 8 : | ktanaka | 1.2 | |
| 9 : | ktanaka | 1.5 | typedef std::pair<int,int> pixel; |
| 10 : | ktanaka | 1.1 | |
| 11 : | class BitmapFont{ | ||
| 12 : | ktanaka | 1.5 | friend std::ostream& operator<<(std::ostream &os,const BitmapFont &bf); |
| 13 : | ktanaka | 1.1 | private: |
| 14 : | int width, height; | ||
| 15 : | ktanaka | 1.5 | std::vector<bool> bitmap; |
| 16 : | std::vector<pixel> pixels; | ||
| 17 : | ktanaka | 1.1 | public: |
| 18 : | ktanaka | 1.6 | int getWidth() const; |
| 19 : | int getHeight() const; | ||
| 20 : | int getSize() const; | ||
| 21 : | int getPixelSize() const; | ||
| 22 : | pixel getPixelAt(int index) const; | ||
| 23 : | BitmapFont(); | ||
| 24 : | BitmapFont(const BitmapFont& b); | ||
| 25 : | BitmapFont(int w,int h); | ||
| 26 : | BitmapFont(int w,int h,const std::vector<pixel> &pxls); | ||
| 27 : | ktanaka | 1.1 | // 暗黙のうちに幅が4ビットの倍数だと仮定している。 |
| 28 : | ktanaka | 1.6 | BitmapFont(int w,int h,const std::string& hex); |
| 29 : | bool get(int x, int y) const; | ||
| 30 : | int getIndex(const pixel &px) const; | ||
| 31 : | ktanaka | 1.1 | }; |
| 32 : | #endif /* _BITMAP_FONT_H */ |
|
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |