micromenu/src/gfx/canvas.cpp
2018-11-05 21:09:01 +01:00

35 lines
No EOL
655 B
C++

//
// 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_;
}