5 #include "textpainter.h"
6 #include "support/LOstream.h"
9 TextPainter::TextPainter(int xmax, int ymax)
10 : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
14 char & TextPainter::at(int x, int y)
16 return data_[y * xmax_ + x];
20 char TextPainter::at(int x, int y) const
22 return data_[y * xmax_ + x];
26 void TextPainter::draw(int x, int y, char const * str)
28 //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
29 for (int i = 0; *str && x + i < xmax_; ++i, ++str)
35 void TextPainter::horizontalLine(int x, int y, int n, char c)
37 for (int i = 0; i < n && i + x < xmax_; ++i)
42 void TextPainter::verticalLine(int x, int y, int n, char c)
44 for (int i = 0; i < n && i + y < ymax_; ++i)
49 void TextPainter::draw(int x, int y, char c)
51 //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
57 void TextPainter::show(std::ostream & os, int offset) const
60 for (int j = 0; j <= ymax_; ++j) {
61 for (int i = 0; i < offset; ++i)
63 for (int i = 0; i < xmax_; ++i)