memlayer.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. typedef struct Memscreen Memscreen;
  10. typedef void (*Refreshfn)(Memimage*, Rectangle, void*);
  11. struct Memscreen
  12. {
  13. Memimage *frontmost; /* frontmost layer on screen */
  14. Memimage *rearmost; /* rearmost layer on screen */
  15. Memimage *image; /* upon which all layers are drawn */
  16. Memimage *fill; /* if non-zero, picture to use when repainting */
  17. };
  18. struct Memlayer
  19. {
  20. Rectangle screenr; /* true position of layer on screen */
  21. Point delta; /* add delta to go from image coords to screen */
  22. Memscreen *screen; /* screen this layer belongs to */
  23. Memimage *front; /* window in front of this one */
  24. Memimage *rear; /* window behind this one*/
  25. int clear; /* layer is fully visible */
  26. Memimage *save; /* save area for obscured parts */
  27. Refreshfn refreshfn; /* function to call to refresh obscured parts if save==nil */
  28. void *refreshptr; /* argument to refreshfn */
  29. };
  30. /*
  31. * These functions accept local coordinates
  32. */
  33. int memload(Memimage*, Rectangle, uint8_t*, int, int);
  34. int memunload(Memimage*, Rectangle, uint8_t*, int);
  35. /*
  36. * All these functions accept screen coordinates, not local ones.
  37. */
  38. void _memlayerop(void (*fn)(Memimage*, Rectangle, Rectangle, void*, int), Memimage*, Rectangle, Rectangle, void*);
  39. Memimage* memlalloc(Memscreen*, Rectangle, Refreshfn, void*, uint32_t);
  40. void memldelete(Memimage*);
  41. void memlfree(Memimage*);
  42. void memltofront(Memimage*);
  43. void memltofrontn(Memimage**, int);
  44. void _memltofrontfill(Memimage*, int);
  45. void memltorear(Memimage*);
  46. void memltorearn(Memimage**, int);
  47. int memlsetrefresh(Memimage*, Refreshfn, void*);
  48. void memlhide(Memimage*, Rectangle);
  49. void memlexpose(Memimage*, Rectangle);
  50. void _memlsetclear(Memscreen*);
  51. int memlorigin(Memimage*, Point, Point);
  52. void memlnorefresh(Memimage*, Rectangle, void*);