uwm_lib.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Small userland drawing library for the ring-3 WM: bpp-aware fills, copies,
  2. * 8x8 glyphs, VGA cell grids and RGB565 canvas blits. No kernel dependencies;
  3. * the WM maps the shadow buffer and calls these functions directly. */
  4. #ifndef UWM_LIB_H
  5. #define UWM_LIB_H
  6. struct ufont_face;
  7. struct usurf {
  8. unsigned char *px;
  9. unsigned int w, h, pitch;
  10. unsigned int bpp; /* 16, 24 or 32 */
  11. struct ufont_face *font; /* NULL = 8x16 bitmap text */
  12. int font_px;
  13. };
  14. struct uwm_canvas {
  15. const unsigned short *px; /* RGB565, tightly packed */
  16. unsigned int w, h;
  17. };
  18. /* Pixels written by the compositor primitives; the WM uses it for stats. */
  19. extern unsigned int usurf_pixels;
  20. void usurf_init(struct usurf *s, void *px, unsigned int w, unsigned int h,
  21. unsigned int pitch, unsigned int bpp);
  22. void usurf_fill(struct usurf *s, int x, int y, unsigned int w,
  23. unsigned int h, unsigned int rgb);
  24. void usurf_copy(struct usurf *s, int dx, int dy, int sx, int sy,
  25. unsigned int w, unsigned int h);
  26. void usurf_glyph(struct usurf *s, int x, int y, unsigned char c,
  27. unsigned int fg, unsigned int bg, int transparent,
  28. unsigned int height,
  29. int cx, int cy, unsigned int cw, unsigned int ch);
  30. void usurf_text(struct usurf *s, int x, int y, const char *str,
  31. unsigned int fg,
  32. int cx, int cy, unsigned int cw, unsigned int ch);
  33. unsigned int usurf_text_width(struct usurf *s, const char *str);
  34. void usurf_font_attach(struct usurf *s, const char *path, int px);
  35. void usurf_cells(struct usurf *s, const unsigned short *cells,
  36. unsigned int cols, unsigned int rows,
  37. int x0, int y0,
  38. int cx, int cy, unsigned int cw, unsigned int ch);
  39. void usurf_canvas(struct usurf *s, const struct uwm_canvas *c,
  40. int x0, int y0,
  41. int cx, int cy, unsigned int cw, unsigned int ch);
  42. #endif