text_canvas.h 1.0 KB

12345678910111213141516171819202122232425262728
  1. /* 8x16 text-cell renderer for window content canvases.
  2. *
  3. * The terminal keeps its 64x32 char+attribute grid; the window server renders
  4. * damaged cells into an RGB565 canvas and the WM composites that canvas like
  5. * any other window content. Freestanding and host-testable. */
  6. #ifndef TEXT_CANVAS_H
  7. #define TEXT_CANVAS_H
  8. #define TEXT_CELL_W 8
  9. #define TEXT_CELL_H 16
  10. struct text_canvas {
  11. unsigned short *px; /* RGB565, w*h, tightly packed */
  12. unsigned int w, h;
  13. };
  14. /* Render the cell block [col0, col0+ncols) x [row0, row0+nrows) of a
  15. * cols x rows cell grid at the canvas top-left. Every pixel of the block is
  16. * written (background included). `cursor` is a linear cell index; the cursor
  17. * bar is drawn when visible and focused. Out-of-range cells are clipped. */
  18. void text_canvas_render(struct text_canvas *c,
  19. const unsigned short *cells,
  20. unsigned int cols, unsigned int rows,
  21. unsigned int col0, unsigned int row0,
  22. unsigned int ncols, unsigned int nrows,
  23. unsigned int cursor, int cursor_visible, int focused);
  24. #endif