memlayer.h 2.2 KB

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