6 #include "textpainter.h"
7 #include "support/LOstream.h"
10 TextPainter::TextPainter(int xmax, int ymax)
11 : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
15 char & TextPainter::at(int x, int y)
17 return data_[y * xmax_ + x];
21 char TextPainter::at(int x, int y) const
23 return data_[y * xmax_ + x];
27 void TextPainter::draw(int x, int y, char const * str)
29 //cerr << "drawing string '" << str << "' at " << x << "," << y << "\n";
30 for (int i = 0; *str && x + i < xmax_; ++i, ++str)
36 void TextPainter::horizontalLine(int x, int y, int n, char c)
38 for (int i = 0; i < n && i + x < xmax_; ++i)
43 void TextPainter::verticalLine(int x, int y, int n, char c)
45 for (int i = 0; i < n && i + y < ymax_; ++i)
50 void TextPainter::draw(int x, int y, char c)
52 //cerr << "drawing char '" << c << "' at " << x << "," << y << "\n";
58 void TextPainter::show(std::ostream & os, int offset) const
61 for (int j = 0; j <= ymax_; ++j) {
62 for (int i = 0; i < offset; ++i)
64 for (int i = 0; i < xmax_; ++i)