layers.pas 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. Added the defines use_amiga_smartlink and
  15. use_auto_openlib. Implemented autoopening
  16. of the library.
  17. 14 Jan 2003.
  18. Update for AmigaOS 3.9.
  19. Changed start code for unit.
  20. 06 Feb 2003.
  21. Changed integer > smallint,
  22. cardinal > longword.
  23. 09 Feb 2003.
  24. [email protected]
  25. }
  26. {$PACKRECORDS 2}
  27. {$IFNDEF FPC_DOTTEDUNITS}
  28. UNIT layers;
  29. {$ENDIF FPC_DOTTEDUNITS}
  30. INTERFACE
  31. {$IFDEF FPC_DOTTEDUNITS}
  32. USES Amiga.Core.Exec, Amiga.Core.Agraphics, Amiga.Core.Utility;
  33. {$ELSE FPC_DOTTEDUNITS}
  34. USES exec, agraphics, utility;
  35. {$ENDIF FPC_DOTTEDUNITS}
  36. const
  37. LAYERSIMPLE = 1;
  38. LAYERSMART = 2;
  39. LAYERSUPER = 4;
  40. LAYERUPDATING = $10;
  41. LAYERBACKDROP = $40;
  42. LAYERREFRESH = $80;
  43. LAYER_CLIPRECTS_LOST = $100; { during BeginUpdate }
  44. { or during layerop }
  45. { this happens if out of memory }
  46. LMN_REGION = -1;
  47. type
  48. pLayer_Info = ^tLayer_Info;
  49. tLayer_Info = record
  50. top_layer : pLayer;
  51. check_lp : pLayer; { !! Private !! }
  52. obs : pClipRect;
  53. FreeClipRects : pClipRect; { !! Private !! }
  54. PrivateReserve1, { !! Private !! }
  55. PrivateReserve2 : Longint; { !! Private !! }
  56. Lock : tSignalSemaphore; { !! Private !! }
  57. gs_Head : tMinList; { !! Private !! }
  58. PrivateReserve3 : smallint; { !! Private !! }
  59. PrivateReserve4 : Pointer; { !! Private !! }
  60. Flags : WORD;
  61. fatten_count : Shortint; { !! Private !! }
  62. LockLayersCount : Shortint; { !! Private !! }
  63. PrivateReserve5 : smallint; { !! Private !! }
  64. BlankHook, { !! Private !! }
  65. LayerInfo_extra : Pointer; { !! Private !! }
  66. end;
  67. const
  68. NEWLAYERINFO_CALLED = 1;
  69. {
  70. * LAYERS_NOBACKFILL is the value needed to get no backfill hook
  71. * LAYERS_BACKFILL is the value needed to get the default backfill hook
  72. }
  73. LAYERS_NOBACKFILL = 1;
  74. LAYERS_BACKFILL = 0;
  75. LAYERSNAME : PAnsiChar = 'layers.library';
  76. VAR LayersBase : pLibrary = nil;
  77. FUNCTION BeginUpdate(l : pLayer location 'a0') : LONGINT; syscall LayersBase 078;
  78. FUNCTION BehindLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1') : LONGINT; syscall LayersBase 054;
  79. FUNCTION CreateBehindHookLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; hook : pHook location 'a3'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 192;
  80. FUNCTION CreateBehindLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 042;
  81. FUNCTION CreateUpfrontHookLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; hook : pHook location 'a3'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 186;
  82. FUNCTION CreateUpfrontLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 036;
  83. FUNCTION DeleteLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1') : LONGINT; syscall LayersBase 090;
  84. PROCEDURE DisposeLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 150;
  85. PROCEDURE DoHookClipRects(hook : pHook location 'a0'; rport : pRastPort location 'a1'; const rect : pRectangle location 'a2'); syscall LayersBase 216;
  86. PROCEDURE EndUpdate(layer : pLayer location 'a0'; flag : ULONG location 'd0'); syscall LayersBase 084;
  87. FUNCTION FattenLayerInfo(li : pLayer_Info location 'a0') : LONGINT; syscall LayersBase 156;
  88. PROCEDURE InitLayers(li : pLayer_Info location 'a0'); syscall LayersBase 030;
  89. FUNCTION InstallClipRegion(layer : pLayer location 'a0';const region : pRegion location 'a1') : pRegion; syscall LayersBase 174;
  90. FUNCTION InstallLayerHook(layer : pLayer location 'a0'; hook : pHook location 'a1') : pHook; syscall LayersBase 198;
  91. FUNCTION InstallLayerInfoHook(li : pLayer_Info location 'a0'; const hook : pHook location 'a1') : pHook; syscall LayersBase 204;
  92. PROCEDURE LockLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'); syscall LayersBase 096;
  93. PROCEDURE LockLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 120;
  94. PROCEDURE LockLayers(li : pLayer_Info location 'a0'); syscall LayersBase 108;
  95. FUNCTION MoveLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1') : LONGINT; syscall LayersBase 060;
  96. FUNCTION MoveLayerInFrontOf(layer_to_move : pLayer location 'a0'; other_layer : pLayer location 'a1') : LONGINT; syscall LayersBase 168;
  97. FUNCTION MoveSizeLayer(layer : pLayer location 'a0'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'; dw : LONGINT location 'd2'; dh : LONGINT location 'd3') : LONGINT; syscall LayersBase 180;
  98. FUNCTION NewLayerInfo : pLayer_Info; syscall LayersBase 144;
  99. PROCEDURE ScrollLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'); syscall LayersBase 072;
  100. FUNCTION SizeLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1') : LONGINT; syscall LayersBase 066;
  101. PROCEDURE SortLayerCR(layer : pLayer location 'a0'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'); syscall LayersBase 210;
  102. PROCEDURE SwapBitsRastPortClipRect(rp : pRastPort location 'a0'; cr : pClipRect location 'a1'); syscall LayersBase 126;
  103. PROCEDURE ThinLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 162;
  104. PROCEDURE UnlockLayer(layer : pLayer location 'a0'); syscall LayersBase 102;
  105. PROCEDURE UnlockLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 138;
  106. PROCEDURE UnlockLayers(li : pLayer_Info location 'a0'); syscall LayersBase 114;
  107. FUNCTION UpfrontLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1') : LONGINT; syscall LayersBase 048;
  108. FUNCTION WhichLayer(li : pLayer_Info location 'a0'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : pLayer; syscall LayersBase 132;
  109. IMPLEMENTATION
  110. const
  111. { Change VERSION and LIBVERSION to proper values }
  112. VERSION : string[2] = '0';
  113. LIBVERSION : longword = 0;
  114. initialization
  115. LayersBase := OpenLibrary(LAYERSNAME,LIBVERSION);
  116. finalization
  117. if Assigned(LayersBase) then
  118. CloseLibrary(LayersBase);
  119. END. (* UNIT LAYERS *)