memlayer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 _memltofrontfill(Memimage*, int);
  39. void memltorear(Memimage*);
  40. void memltorearn(Memimage**, int);
  41. int memlsetrefresh(Memimage*, Refreshfn, void*);
  42. void memlhide(Memimage*, Rectangle);
  43. void memlexpose(Memimage*, Rectangle);
  44. void _memlsetclear(Memscreen*);
  45. int memlorigin(Memimage*, Point, Point);
  46. void memlnorefresh(Memimage*, Rectangle, void*);