3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "textpainter.h"
14 #include "support/std_ostream.h"
17 TextPainter::TextPainter(int xmax, int ymax)
18 : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
22 char & TextPainter::at(int x, int y)
24 return data_[y * xmax_ + x];
28 char TextPainter::at(int x, int y) const
30 return data_[y * xmax_ + x];
34 void TextPainter::draw(int x, int y, char const * str)
36 //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
37 for (int i = 0; *str && x + i < xmax_; ++i, ++str)
43 void TextPainter::horizontalLine(int x, int y, int n, char c)
45 for (int i = 0; i < n && i + x < xmax_; ++i)
50 void TextPainter::verticalLine(int x, int y, int n, char c)
52 for (int i = 0; i < n && i + y < ymax_; ++i)
57 void TextPainter::draw(int x, int y, char c)
59 //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
65 void TextPainter::show(std::ostream & os, int offset) const
68 for (int j = 0; j <= ymax_; ++j) {
69 for (int i = 0; i < offset; ++i)
71 for (int i = 0; i < xmax_; ++i)