| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /* Small userland drawing library for the ring-3 WM: bpp-aware fills, copies,
- * 8x8 glyphs, VGA cell grids, RGB565 canvas blits and the Adwaita icon masks.
- * No kernel dependencies; the WM maps the shadow buffer and calls these
- * functions directly. */
- #ifndef UWM_LIB_H
- #define UWM_LIB_H
- #include "icon_abi.h"
- #include "app_icon_abi.h"
- struct ufont_face;
- /* Icon ids from the same list the ngui tools use; the order is the bundle
- * order. The WM does not link ngui, so it generates its own ids. */
- #define UWM_ICON_ENUM_(e, name, file) UWM_ICON_##e,
- enum uwm_icon {
- ICON_LIST(UWM_ICON_ENUM_)
- UWM_ICON_COUNT
- };
- #undef UWM_ICON_ENUM_
- struct usurf {
- unsigned char *px;
- unsigned int w, h, pitch;
- unsigned int bpp; /* 16, 24 or 32 */
- struct ufont_face *font; /* NULL = 8x16 bitmap text */
- int font_px;
- };
- struct uwm_canvas {
- const unsigned short *px; /* RGB565, tightly packed */
- unsigned int w, h;
- };
- /* Pixels written by the compositor primitives; the WM uses it for stats. */
- extern unsigned int usurf_pixels;
- void usurf_init(struct usurf *s, void *px, unsigned int w, unsigned int h,
- unsigned int pitch, unsigned int bpp);
- void usurf_fill(struct usurf *s, int x, int y, unsigned int w,
- unsigned int h, unsigned int rgb);
- void usurf_copy(struct usurf *s, int dx, int dy, int sx, int sy,
- unsigned int w, unsigned int h);
- void usurf_glyph(struct usurf *s, int x, int y, unsigned char c,
- unsigned int fg, unsigned int bg, int transparent,
- unsigned int height,
- int cx, int cy, unsigned int cw, unsigned int ch);
- void usurf_text(struct usurf *s, int x, int y, const char *str,
- unsigned int fg,
- int cx, int cy, unsigned int cw, unsigned int ch);
- unsigned int usurf_text_width(struct usurf *s, const char *str);
- void usurf_font_attach(struct usurf *s, const char *path, int px);
- void usurf_cells(struct usurf *s, const unsigned short *cells,
- unsigned int cols, unsigned int rows,
- int x0, int y0,
- int cx, int cy, unsigned int cw, unsigned int ch);
- void usurf_canvas(struct usurf *s, const struct uwm_canvas *c,
- int x0, int y0,
- int cx, int cy, unsigned int cw, unsigned int ch);
- /* Blit one 16x16 Adwaita coverage mask, tinted with `rgb`, blended over the
- * surface. Returns 0 when the bundle (or that id) is not available. */
- int usurf_icon(struct usurf *s, int x, int y, enum uwm_icon icon,
- unsigned int rgb);
- /* Icon blit clipped to (cx,cy,cw,ch), in screen coordinates. */
- int usurf_icon_clip(struct usurf *s, int x, int y, enum uwm_icon icon,
- unsigned int rgb, int cx, int cy,
- unsigned int cw, unsigned int ch);
- /* Soft drop shadow around a window rectangle: `spread` pixels outward,
- * darkest next to the edge, clipped to (cx,cy,cw,ch). The window interior
- * is not modified. */
- void usurf_window_shadow(struct usurf *s, int wx, int wy, int ww, int wh,
- int spread, int cx, int cy,
- unsigned int cw, unsigned int ch);
- /* Draw one full-colour app icon from /ramfs/icons/apps96.icn, scaled to
- * size x size and centred at (x, y). Returns 0 when the bundle (or that
- * id) is not available, so the caller can fall back to a letter tile. */
- int usurf_app_icon(struct usurf *s, int x, int y, int size,
- enum app_icon icon);
- /* A rounded rectangle blended over the surface at `alpha` (0..255). The
- * dock uses it for its translucent panel and the hover label. */
- void usurf_fill_round_alpha(struct usurf *s, int x, int y, int w, int h,
- int radius, unsigned int rgb,
- unsigned int alpha);
- #endif
|