🔍

receipt printer

#include <vector>

void grayscaleToBitmap(const std::vector<int> &grayscaleValues, uint8_t *bitmap, int width, int height) {
  int index = 0;
  for (int row = 0; row < height; row++) {
    for (int col = 0; col < width; col++) {
      bitmap[index++] = static_cast<uint8_t>(grayscaleValues[row * width + col]);
    }
  }
}