summaryrefslogtreecommitdiffstats
path: root/kpacman/bitfont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kpacman/bitfont.cpp')
-rw-r--r--kpacman/bitfont.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/kpacman/bitfont.cpp b/kpacman/bitfont.cpp
deleted file mode 100644
index f1535fb..0000000
--- a/kpacman/bitfont.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include "bitfont.h"
-
-Bitfont::Bitfont(TQString fontname, uchar firstChar, uchar lastChar)
-{
- if (!fontname.isEmpty())
- font.load(fontname);
- if (font.width() == font.height()) {
- fontWidth = fontHeight = font.width() / 16;
- fontFirstChar = 1;
- fontLastChar = 255;
- } else {
- fontWidth = font.width()/(lastChar-firstChar+1);
- fontHeight = font.height();
- fontFirstChar = firstChar;
- fontLastChar = lastChar;
- }
-}
-
-TQRect Bitfont::rect(TQString str)
-{
- return TQRect(0, 0, str.length()*fontWidth, fontHeight);
-}
-
-TQPixmap Bitfont::text(TQString str, TQColor fg, TQColor bg)
-{
- TQPixmap FG(str.length()*fontWidth, fontHeight);
- TQBitmap MASK(str.length()*fontWidth, fontHeight, TRUE);
-
- const uchar *s = reinterpret_cast<const unsigned char *>(str.latin1());
- for (uint i = 0; i < str.length(); i++) {
- if (font.width() == font.height())
- bitBlt(&MASK, i*fontWidth, 0, &font,
- (*s%16)*fontWidth, (*s/16)*fontWidth, fontWidth, fontHeight);
- else
- if (*s >= fontFirstChar && *s <= fontLastChar)
- bitBlt(&MASK, i*fontWidth, 0, &font,
- (*s-fontFirstChar)*fontWidth, 0, fontWidth, fontHeight);
- s++;
- }
-
- FG.fill(fg);
- FG.setMask(MASK);
-
- if (bg.isValid()) {
- TQPixmap BG(str.length()*fontWidth, fontHeight);
- BG.fill(bg);
- bitBlt(&BG, 0, 0, &FG);
- return BG;
- } else
- return FG;
-}
-
-uchar Bitfont::firstChar()
-{
- return fontFirstChar;
-}
-
-uchar Bitfont::lastChar()
-{
- return fontLastChar;
-}
-
-int Bitfont::width()
-{
- return fontWidth;
-}
-
-int Bitfont::height()
-{
- return fontHeight;
-}