memlayer.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma src "/sys/src/libmemlayer"
  2. #pragma lib "libmemlayer.a"
  3. typedef struct Memscreen Memscreen;
  4. typedef void (*Refreshfn)(Memimage*, Rectangle, void*);
  5. struct Memscreen
  6. {
  7. Memimage *frontmost; /* frontmost layer on screen */
  8. Memimage *rearmost; /* rearmost layer on screen */
  9. Memimage *image; /* upon which all layers are drawn */
  10. Memimage *fill; /* if non-zero, picture to use when repainting */
  11. };
  12. struct Memlayer
  13. {
  14. Rectangle screenr; /* true position of layer on screen */
  15. Point delta; /* add delta to go from image coords to screen */
  16. Memscreen *screen; /* screen this layer belongs to */
  17. Memimage *front; /* window in front of this one */
  18. Memimage *rear; /* window behind this one*/
  19. int clear; /* layer is fully visible */
  20. Memimage *save; /* save area for obscured parts */
  21. Refreshfn refreshfn; /* function to call to refresh obscured parts if save==nil */
  22. void *refreshptr; /* argument to refreshfn */
  23. };
  24. /*
  25. * These functions accept local coordinates
  26. */
  27. int memload(Memimage*, Rectangle, uchar*, int, int);
  28. int memunload(Memimage*, Rectangle, uchar*, int);
  29. /*
  30. * All these functions accept screen coordinates, not local ones.
  31. */
  32. void _memlayerop(void (*fn)(Memimage*, Rectangle, Rectangle, void*, int), Memimage*, Rectangle, Rectangle, void*);
  33. Memimage* memlalloc(Memscreen*, Rectangle, Refreshfn, void*, ulong);
  34. void memldelete(Memimage*);
  35. void memlfree(Memimage*);
  36. void memltofront(Memimage*);
  37. void memltofrontn(Memimage**, int);
  38. void memltorear(Memimage*);
  39. void memltorearn(Memimage**, int);
  40. int memlsetrefresh(Memimage*, Refreshfn, void*);
  41. void memlhide(Memimage*, Rectangle);
  42. void memlexpose(Memimage*, Rectangle);
  43. void _memlsetclear(Memscreen*);
  44. int memlorigin(Memimage*, Point, Point);
  45. void memlnorefresh(Memimage*, Rectangle, void*);