// // Created by jedi on 11/1/18. // #include "gfx/canvas.h" canvas::canvas(int w, int h) : width_(w), height_(h), buffer_(w*h) { clear(); } void canvas::clear() { for (int x = 0; x < width_; x++) for (int y = 0; y < height_; y++) buffer_.set(x * height_ + y, false); } void canvas::draw(int x, int y) { buffer_.set(x * height_ + y, true); } void canvas::print(int x, int y, const char *str, font& f) { f.print(x, y, str, *this); } void canvas::print(int x, int y, char *str, font& f) { f.print(x, y, str, *this); } int canvas::getWidth(){ return width_; } int canvas::getHeight(){ return height_; }