Browse Source

os4units: inputevents and library unit for layer.library

git-svn-id: trunk@33560 -
marcus 9 years ago
parent
commit
6e9e508091
4 changed files with 475 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 2 0
      packages/os4units/fpmake.pp
  3. 238 0
      packages/os4units/src/inputevent.pas
  4. 233 0
      packages/os4units/src/layers.pas

+ 2 - 0
.gitattributes

@@ -6319,6 +6319,8 @@ packages/os4units/fpmake.pp svneol=native#text/pascal
 packages/os4units/src/agraphics.pas svneol=native#text/pascal
 packages/os4units/src/amigados.pas svneol=native#text/pascal
 packages/os4units/src/exec.pas svneol=native#text/pascal
+packages/os4units/src/inputevent.pas svneol=native#text/pascal
+packages/os4units/src/layers.pas svneol=native#text/pascal
 packages/os4units/src/timer.pas svneol=native#text/pascal
 packages/os4units/src/utility.pas svneol=native#text/pascal
 packages/palmunits/Makefile svneol=native#text/plain

+ 2 - 0
packages/os4units/fpmake.pp

@@ -36,6 +36,8 @@ begin
     T:=P.Targets.AddUnit('utility.pas');
     T:=P.Targets.AddUnit('amigados.pas');
     T:=P.Targets.AddUnit('agraphics.pas');
+    T:=P.Targets.AddUnit('layers.pas');
+    T:=P.Targets.AddUnit('inputevent.pas');
 
 {$ifndef ALLPACKAGES}
     Run;

+ 238 - 0
packages/os4units/src/inputevent.pas

@@ -0,0 +1,238 @@
+{
+    This file is part of the Free Pascal run time library.
+
+    A file in Amiga system run time library.
+    Copyright (c) 1998 by Nils Sjoholm
+    member of the Amiga RTL development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$PACKRECORDS 2}
+unit inputevent;
+
+INTERFACE
+
+uses exec, utility, timer;
+
+const
+
+//------ constants
+//--- InputEvent.ie_Class
+  IECLASS_NULL           = $00; // A NOP input event
+  IECLASS_RAWKEY         = $01; // A raw keycode from the keyboard device
+  IECLASS_RAWMOUSE       = $02; // The raw mouse report from the game port device
+  IECLASS_EVENT          = $03; // A private console event
+  IECLASS_POINTERPOS     = $04; // A Pointer Position report
+  IECLASS_TIMER          = $06; // A timer event
+  IECLASS_GADGETDOWN     = $07; // select button pressed down over a Gadget (address in ie_EventAddress)
+  IECLASS_GADGETUP       = $08; // select button released over the same Gadget (address in ie_EventAddress)
+  IECLASS_REQUESTER      = $09; // some Requester activity has taken place.  See Codes REQCLEAR and REQSET
+  IECLASS_MENULIST       = $0A; // this is a Menu Number transmission (Menu number is in ie_Code)
+  IECLASS_CLOSEWINDOW    = $0B; // User has selected the active Window's Close Gadget
+  IECLASS_SIZEWINDOW     = $0C; // this Window has a new size
+  IECLASS_REFRESHWINDOW  = $0D; // the Window pointed to by ie_EventAddress needs to be refreshed
+  IECLASS_NEWPREFS       = $0E; // new preferences are available
+  IECLASS_DISKREMOVED    = $0F; // the disk has been removed
+  IECLASS_DISKINSERTED   = $10; // the disk has been inserted
+  IECLASS_ACTIVEWINDOW   = $11; // the window is about to be been made active
+  IECLASS_INACTIVEWINDOW = $12; // the window is about to be made inactive
+  IECLASS_NEWPOINTERPOS  = $13; // extended-function pointer position report (V36)
+  IECLASS_MENUHELP       = $14; // Help key report during Menu session (V36)
+  IECLASS_CHANGEWINDOW   = $15; // the Window has been modified with move, size, zoom, or change (V36)
+  IECLASS_RESERVED       = $16; // reserved
+  IECLASS_MOUSEWHEEL     = $17; // the mousewheel report from the gameport (V51)
+  IECLASS_EXTENDEDRAWKEY = $18; // A 16bit raw keycode from the keyboard device (V51), see below for subclasses.
+
+  IECLASS_MAX            = $18; //the last class
+
+// --- InputEvent.ie_SubClass ---
+//  IECLASS_NEWPOINTERPOS
+//    like IECLASS_POINTERPOS
+  IESUBCLASS_COMPATIBLE  = $00;
+  IESUBCLASS_PIXEL       = $01; // ie_EventAddress points to struct IEPointerPixel
+  IESUBCLASS_TABLET      = $02; // ie_EventAddress points to struct IEPointerTablet
+
+//  IECLASS_EXTENDED_RAWKEY
+  IESUBCLASS_AMIGA_RAWKEY             = $00;
+  IESUBCLASS_SET1_RAWKEY              = $01;
+  IESUBCLASS_HID_CONSUMER_DOWN_RAWKEY = $02;
+  IESUBCLASS_HID_CONSUMER_UP_RAWKEY   = $03;
+
+type
+// pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS and IESUBCLASS_PIXEL.
+// You specify a screen and pixel coordinates in that screen at which you'd like the mouse to be positioned.
+// Intuition will try to oblige, but there will be restrictions to positioning the pointer over offscreen pixels.
+//
+// IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
+  PIEPointerPixel = ^TIEPointerPixel;
+  TIEPointerPixel = record
+    iepp_Screen: Pointer; // (PScreen) pointer to an open screen
+    iepp_Position : record
+      x, y: SmallInt;
+    end;
+  end;
+
+// pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS and IESUBCLASS_TABLET.
+//
+// You specify a range of values and a value within the range independently for each of X and Y (the minimum value of the ranges is always normalized to 0).
+//
+// Intuition will position the mouse proportionally within its natural mouse position rectangle limits.
+//
+//  IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
+  PIEPointerTablet = ^TIEPointerTablet;
+  TIEPointerTablet = record
+    iept_Range: record    // 0 is min, these are max
+      x, y: Word;
+    end;
+    iept_Value: record    // between 0 AND iept_Range
+      x, y: Word;
+    end;
+    iept_Pressure: Word;  // -128 to 127 (unused, set to 0)
+  end;
+
+// The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass IESUBCLASS_NEWTABLET points at an IENewTablet structure.
+// IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET.
+  PIENewTablet = ^TIENewTablet;
+  TIENewTablet = record
+    { Pointer to a hook you wish to be called back through, in order to handle scaling.  You will be provided with the
+      width and height you are expected to scale your tablet to, perhaps based on some user preferences.
+      If nil, the tablet's specified range will be mapped directly to that width and height for you, and you will not be called back.}
+    ient_CallBack : pHook;
+
+    { Post-scaling coordinates and fractional coordinates. DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!
+      Your driver will be called back and provided information about the width and height of the area to scale the
+      tablet into.  It should scale the tablet coordinates (perhaps based on some preferences controlling aspect
+      ratio, etc.) and place the scaled result into these fields.  The ient_ScaledX and ient_ScaledY fields are
+      in screen-pixel resolution, but the origin ([0,0]-point) is not defined. The ient_ScaledXFraction and
+      ient_ScaledYFraction fields represent sub-pixel position information, and should be scaled to fill a Word fraction.}
+    ient_ScaledX,
+    ient_ScaledY,
+    ient_ScaledXFraction,
+    ient_ScaledYFraction: Word;
+
+    // Current tablet coordinates along each axis:
+    ient_TabletX, ient_TabletY: LongWord;
+
+    // Tablet range along each axis.  For example, if ient_TabletX can take values 0-999, ient_RangeX should be 1000.
+    ient_RangeX, ient_RangeY: LongWord;
+
+    // Pointer to tag-list of additional tablet attributes. See intuition for the tag values.
+    ient_TagList: PTagItem;
+  end;
+
+const
+//--- InputEvent.ie_Code
+// IECLASS_RAWKEY
+  IECODE_UP_PREFIX       = $80;
+  IECODE_KEY_CODE_FIRST  = $00;
+  IECODE_KEY_CODE_LAST   = $77;
+  IECODE_COMM_CODE_FIRST = $78;
+  IECODE_COMM_CODE_LAST  = $7F;
+// IECLASS_ANSI
+  IECODE_C0_FIRST        = $00;
+  IECODE_C0_LAST         = $1F;
+  IECODE_ASCII_FIRST     = $20;
+  IECODE_ASCII_LAST      = $7E;
+  IECODE_ASCII_DEL       = $7F;
+  IECODE_C1_FIRST        = $80;
+  IECODE_C1_LAST         = $9F;
+  IECODE_LATIN1_FIRST    = $A0;
+  IECODE_LATIN1_LAST     = $FF;
+// IECLASS_RAWMOUSE
+  IECODE_LBUTTON         = $68; // also uses IECODE_UP_PREFIX
+  IECODE_RBUTTON         = $69;
+  IECODE_MBUTTON         = $6A;
+  IECODE_4TH_BUTTON      = $7E; // also called 'side'
+  IECODE_5TH_BUTTON      = $78; // also called 'extra'
+  IECODE_NOBUTTON        = $FF;
+// IECLASS_EVENT (V36)
+  IECODE_NEWACTIVE       = $01; // new active input window
+  IECODE_NEWSIZE         = $02; // resize of window
+  IECODE_REFRESH         = $03; // refresh of window
+
+// IECLASS_REQUESTER Codes
+  IECODE_REQSET   = $01; // broadcast when the first Requester (not subsequent ones) opens in the Window
+  IECODE_REQCLEAR = $00; // broadcast when the last Requester clears out of the Window
+
+//--- InputEvent.ie_Qualifier
+  IEQUALIFIER_LSHIFT          = $0001;
+  IEQUALIFIER_RSHIFT          = $0002;
+  IEQUALIFIER_CAPSLOCK        = $0004;
+  IEQUALIFIER_CONTROL         = $0008;
+  IEQUALIFIER_LALT            = $0010;
+  IEQUALIFIER_RALT            = $0020;
+  IEQUALIFIER_LCOMMAND        = $0040;
+  IEQUALIFIER_RCOMMAND        = $0080;
+  IEQUALIFIER_NUMERICPAD      = $0100;
+  IEQUALIFIER_REPEAT          = $0200;
+  IEQUALIFIER_INTERRUPT       = $0400;
+  IEQUALIFIER_MULTIBROADCAST  = $0800;
+  IEQUALIFIER_MIDBUTTON       = $1000;
+  IEQUALIFIER_RBUTTON         = $2000;
+  IEQUALIFIER_LEFTBUTTON      = $4000;
+  IEQUALIFIER_RELATIVEMOUSE   = $8000;
+
+  IEQUALIFIERB_LSHIFT         = 0;
+  IEQUALIFIERB_RSHIFT         = 1;
+  IEQUALIFIERB_CAPSLOCK       = 2;
+  IEQUALIFIERB_CONTROL        = 3;
+  IEQUALIFIERB_LALT           = 4;
+  IEQUALIFIERB_RALT           = 5;
+  IEQUALIFIERB_LCOMMAND       = 6;
+  IEQUALIFIERB_RCOMMAND       = 7;
+  IEQUALIFIERB_NUMERICPAD     = 8;
+  IEQUALIFIERB_REPEAT         = 9;
+  IEQUALIFIERB_INTERRUPT      = 10;
+  IEQUALIFIERB_MULTIBROADCAST = 11;
+  IEQUALIFIERB_MIDBUTTON      = 12;
+  IEQUALIFIERB_RBUTTON        = 13;
+  IEQUALIFIERB_LEFTBUTTON     = 14;
+  IEQUALIFIERB_RELATIVEMOUSE  = 15;
+
+//------ InputEvent
+type
+  PInputEvent = ^TInputEvent;
+  TInputEvent = record
+    ie_NextEvent: PInputEvent;
+    ie_Class: Byte;
+    ie_SubClass: Byte;
+    ie_Code: Word;
+    ie_Qualifier: Word;
+    ie_position: record
+      case longint of
+        0:(ie_xy: record
+            ie_x: SmallInt;
+            ie_y: SmallInt;
+          end);
+        1:(ie_addr: APTR);
+        2:(ie_dead: record
+            ie_prev1DownCode : Byte;
+            ie_prev1DownQual : Byte;
+            ie_prev2DownCode : Byte;
+            ie_prev2DownQual : Byte;
+          end);
+      end;
+    ie_TimeStamp: TTimeVal;
+  end;
+
+//----- ExtendedDeadKey
+  PExtendedDeadKey = ^TExtendedDeadKey;
+  TExtendedDeadKey = record
+    Reserved: LongWord;
+    Prev1DownClass: Word;
+    Prev1DownCode: Word;
+    Prev1DownQual: Word;
+    Prev2DownClass: Word;
+    Prev2DownCode: Word;
+    Prev2DownQual: Word;
+  end;
+
+implementation
+
+end.

+ 233 - 0
packages/os4units/src/layers.pas

@@ -0,0 +1,233 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2016 by Free Pascal development team
+
+    layers.library functions for Amiga OS 4.x
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$PACKRECORDS 2}
+
+unit layers;
+
+interface
+
+uses
+  exec, agraphics, utility;
+
+const
+  LAYERSIMPLE           = 1;
+  LAYERSMART            = 2;
+  LAYERSUPER            = 4;
+  LAYEROFFSCREEN        = 8;     // New for V53 (system private)
+  LAYERUPDATING         = $10;
+  LAYERBACKDROP         = $40;
+  LAYERREFRESH          = $80;
+  LAYER_CLIPRECTS_LOST  = $100;  // during BeginUpdate or during layerop this happens if out of memory
+  LAYERIREFRESH         = $200;
+  LAYERIREFRESH2        = $400;
+  LAYERSAVEBACK         = $800;  // New for V44: Set if clips are saved back
+  LAYERHIDDEN           = $1000; // New for V45: Layer is invisible
+  LAYERSTAYTOP          = $2000; // New for V45: Layer can't be moved behind other layers
+  LAYERMOVECHANGESSHAPE = $4000; // New for V45: Report MoveLayer() to shapechangehook
+  LAYERBACKUP           = $8000; // New for V53 (system private)
+
+  ALPHA_PREFIX = $01000000;
+type
+  PLayer_Info = ^TLayer_Info;
+  TLayer_Info = record
+    top_layer: PLayer;         // Frontmost layer
+    resPtr1: Pointer;          // V45 spare
+    resPtr2: Pointer;          // Another V45 spare
+    FreeClipRects: PClipRect;  // Implements a backing store of cliprects to avoid frequent re-allocation of cliprects. Private
+    Bounds: TRectangle;        // clipping bounds of this layer info. All layers are clipped against this
+    Lock: TSignalSemaphore;    // Layer_Info lock
+    gs_Head: TMinList;         // linked list of all semaphores of all layers within this layer info
+    PrivateReserve3: Smallint; // Private
+    ClipRectPool: APTR;        // V45: Pool for cliprects (private use only)
+    Flags: Word;
+    fatten_count: Shortint;    // V45 spare, no longer used
+    LockLayersCount: Shortint; // Counts # times LockLayers has been called
+    PrivateReserve5: smallint; // Private
+    BlankHook: PHook;          // LayerInfo backfill hook
+    LayerInfo_extra: Pointer;  // Private
+  end;
+
+const
+  NEWLAYERINFO_CALLED = 1;
+  LIF_EXTLBOUNDS  = $0200; // System private
+  LIF_OFFSCREEN   = $0400; // System private
+  LIF_SYNCCOMPOSE = $0800; // System private
+  LIF_SYNCALWAYS  = $1000; // System private
+  LIF_COLLECTONLY = $2000; // System private
+  LIF_IGNORE      = $4000; // System private
+  LIF_OPTIMIZE    = $8000; // System private
+
+  // Special backfill hook values you may want to install here.
+  LAYERS_NOBACKFILL = PHook(1);  // the value needed to get no backfill hook
+  LAYERS_BACKFILL   = PHook(0);  // the value needed to get the default backfill hook
+
+  // Special codes for ShowLayer(): Give this as target layer where to move your layer to.
+  LAYER_BACKMOST  = PLayer(0);
+  LAYER_FRONTMOST = PLayer(1);
+
+  //CreateBackFillHookA() attributes
+  LAYERS_DUMMY = TAG_USER;
+  BFHA_APen    = LAYERS_DUMMY + 0; // foreground color (def not 0)
+  BFHA_BPen    = LAYERS_DUMMY + 1; // background color (def not 0)
+  BFHA_DrMd    = LAYERS_DUMMY + 2; // drawmode (def JAM2)
+  BFHA_PatSize = LAYERS_DUMMY + 3; // pattern size, see SetAfPt()
+  BFHA_Pattern = LAYERS_DUMMY + 4; // the pattern
+  BFHA_BitMap  = LAYERS_DUMMY + 5; // bitmap to use as backfill
+  BFHA_Width   = LAYERS_DUMMY + 6; // width of bm
+  BFHA_Height  = LAYERS_DUMMY + 7; // height of bm
+  BFHA_OffsetX = LAYERS_DUMMY + 8; // x offset into the bm
+  BFHA_OffsetY = LAYERS_DUMMY + 9; // y offset into the bm
+
+  //CreateLayerA() attributes
+  LAYA_MinX        = LAYERS_DUMMY + 30; // upper left corner
+  LAYA_MinY        = LAYERS_DUMMY + 31; // of layer
+  LAYA_MaxX        = LAYERS_DUMMY + 32; // lower right corner
+  LAYA_MaxY        = LAYERS_DUMMY + 33; // of layer
+  LAYA_ShapeRegion = LAYERS_DUMMY + 34; // shape of this layer
+  LAYA_ShapeHook   = LAYERS_DUMMY + 35; // hook to create layer shape
+  LAYA_InFrontOf   = LAYERS_DUMMY + 36; // create the layer in front of the given one
+  LAYA_BitMap        = LAYERS_DUMMY + 37; // common bitmap used by all layers
+  LAYA_SuperBitMap   = LAYERS_DUMMY + 38; // the superbitmap, sets LAYERSUPER
+  LAYA_SimpleRefresh = LAYERS_DUMMY + 39; // make it a simple refresh layer
+  LAYA_SmartRefresh  = LAYERS_DUMMY + 40; // smart refresh layer (default TRUE)
+  LAYA_Hidden        = LAYERS_DUMMY + 41; // make it invisible
+  LAYA_Backdrop      = LAYERS_DUMMY + 42; // request backdrop layer
+  LAYA_Flags         = LAYERS_DUMMY + 43; // layer flags
+  LAYA_BackFillHook  = LAYERS_DUMMY + 44; // backfill hook for this layer
+  LAYA_Behind        = LAYERS_DUMMY + 45; // create behind layer (default FALSE)
+  LAYA_StayTop       = LAYERS_DUMMY + 46; // create a window that stays on top of all other layers
+  LAYA_AlphaClips    = LAYERS_DUMMY + 47; // alpha shape of this layer
+  LAYA_AlphaHook     = LAYERS_DUMMY + 48; // hook to create layer alpha shape
+  LAYA_Opaqueness    = LAYERS_DUMMY + 49; // opaqueness of this layer
+  LAYA_Window        = LAYERS_DUMMY + 50; // window associated to this layer (system use only)
+  LAYA_Padding       = LAYERS_DUMMY + 51; // extra padding on layer sides, extending screen redraw area (system use only)
+
+  //SetLayerInfoAttrsA()/GetLayerInfoAttrsA() attributes
+  LAYERINFO_BackFillHook    = LAYERS_DUMMY + 100; // Backfill hook for this LayerInfo
+  LAYERINFO_Bounds          = LAYERS_DUMMY + 101; // Clipping bounds for this LayerInfo
+  LAYERINFO_OffScreenBitMap = LAYERS_DUMMY + 102; // Common offscreen bitmap for this LayerInfo's layers
+  LAYERINFO_ComposeHook     = LAYERS_DUMMY + 103; // Compositing hook for this LayerInfo
+  LAYERINFO_ComposeLock     = LAYERS_DUMMY + 104; // Semaphore protecting compositing hook
+
+// The message a backfill hook receives
+type
+  PBackFillMessage = ^TBackFillMessage;
+  TBackFillMessage = record
+    Layer: PLayer;
+    Bounds: TRectangle;
+    OffsetX: LongInt;
+    OffsetY: LongInt;
+  end;
+
+// The message a compose hook receives (system private)
+  PLayerComposeMsg = ^TLayerComposeMsg;
+  TLayerComposeMsg = record
+    Action: LongWord;
+    LayerInfo: PLayer_Info;
+    BackBitMap: PBitMap;
+    Bounds: TRectangle;
+  end;
+const
+  LCM_COMPOSE = 0;
+  LCM_DAMAGE  = 1;
+
+  LAYERSNAME: PChar = 'layers.library';
+var
+  LayersBase: PLibrary = nil;
+  ILayers: PInterface = nil;
+
+function LayersObtain(): LongWord; syscall ILayers 60;
+function LayersRelease(): LongWord; syscall ILayers 64;
+procedure LayersExpunge(); syscall ILayers 68;
+function LayersClone(): PInterface; syscall ILayers 72;
+procedure InitLayers(Li: PLayer_Info); syscall ILayers 76;
+function CreateUpfrontLayer(Li: PLayer_Info; Bm: PBitMap; X0, Y0, X1, Y1, Flags: LongInt; Bm2: PBitMap): PLayer; syscall ILayers 80;
+function CreateBehindLayer(Li: PLayer_Info; Bm: PBitMap; X0, Y0, X1, Y1, Flags: LongInt; Bm2: PBitMap): PLayer; syscall ILayers 84;
+function UpfrontLayer(Dummy: LongInt; Layer: PLayer): LongInt; syscall ILayers 88;
+function BehindLayer(Dummy: LongInt; Layer: PLayer): LongInt; syscall ILayers 92;
+function MoveLayer(Dummy: LongInt; Layer: PLayer; Dx, Dy: LongInt): LongInt; syscall ILayers 96;
+function SizeLayer(Summy: LongInt; Layer: PLayer; Dx, Dy: LongInt): LongInt; syscall ILayers 100;
+procedure ScrollLayer(Dummy: LongInt; Layer: PLayer; Dx, Dy: LongInt); syscall ILayers 104;
+function BeginUpdate(L: PLayer): LongInt; syscall ILayers 108;
+procedure EndUpdate(Layer: PLayer; Flag: LongWord); syscall ILayers 112;
+function DeleteLayer(Dummy: LongInt; Layer: PLayer): LongInt; syscall ILayers 116;
+procedure LockLayer(Dummy: LongInt; Layer: PLayer); syscall ILayers 120;
+procedure UnlockLayer(Layer: PLayer); syscall ILayers 124;
+procedure LockLayers(Li: PLayer_Info); syscall ILayers 128;
+procedure UnlockLayers(Li: PLayer_Info); syscall ILayers 132;
+procedure LockLayerInfo(Li: PLayer_Info); syscall ILayers 136;
+procedure SwapBitsRastPortClipRect(Rp: PRastPort; Cr: PClipRect); syscall ILayers 140;
+function WhichLayer(Li: PLayer_Info; X, Y: SmallInt): PLayer; syscall ILayers 144;
+procedure UnlockLayerInfo(Li: PLayer_Info); syscall ILayers 148;
+function NewLayerInfo: PLayer_Info; syscall ILayers 152;
+procedure DisposeLayerInfo(Li: PLayer_Info); syscall ILayers 156;
+function FattenLayerInfo(Li: PLayer_Info): LongInt; syscall ILayers 160;
+procedure ThinLayerInfo(Li: PLayer_Info); syscall ILayers 164;
+function MoveLayerInFrontOf(LayerToMove: PLayer; OtherLayer: PLayer): LongInt; syscall ILayers 168;
+function InstallClipRegion(Layer: PLayer; const Region: PRegion): PRegion; syscall ILayers 172;
+function MoveSizeLayer(Layer: PLayer; Dx, Dy, Dw, Dh: LongInt): LongInt; syscall ILayers 176;
+function CreateUpfrontHookLayer(Li: PLayer_Info; Bm: PBitMap; X0, Y0, X1, Y1, Flags: LongInt; Hook: PHook; Bm2: PBitMap): PLayer; syscall ILayers 180;
+function CreateBehindHookLayer(Li: PLayer_Info; Bm: PBitMap; X0, Y0, X1, Y1, Flags: LongInt; Hook: PHook; Bm2: PBitMap): PLayer; syscall ILayers 184;
+function InstallLayerHook(Layer: PLayer; Hook: PHook): PHook; syscall ILayers 188;
+function InstallLayerInfoHook(Li: PLayer_Info; const Hook: PHook): PHook; syscall ILayers 192;
+procedure SortLayerCR(Layer: PLayer; Dx, Dy: SmallInt); syscall ILayers 196;
+procedure DoHookClipRects(Hook: PHook; RPort: PRastPort; const Rect: PRectangle); syscall ILayers 200;
+function LayerOccluded(Layer: PLayer): LongInt; syscall ILayers 204;
+function HideLayer(Layer: PLayer): LongInt; syscall ILayers 208;
+function ShowLayer(Layer: PLayer): LongInt; syscall ILayers 212;
+function SetLayerInfoBounds(Li: PLayer_Info; Bounds: PRectangle): LongInt; syscall ILayers 216;
+function AllocClipRect(Li: PLayer_Info): PClipRect; syscall ILayers 220;
+procedure FreeClipRect(Li: PLayer_Info; Cr: PClipRect); syscall ILayers 224;
+function CreateLayerA(Li: PLayer_Info; TList: PTagItem): PLayer; syscall ILayers 228;
+// 232 CreateLayer
+function ChangeLayerShape(Layer: PLayer; Region: PRegion; Hook: PHook): PRegion; syscall ILayers 236;
+function CreateBackFillHookA(TList: PTagItem): PHook; syscall ILayers 240;
+// 244 CreateBackFillHook
+procedure DeleteBackFillHook(Hook: PHook); syscall ILayers 248;
+function SetBackFillHookAttrsA(Hook: PHook; Tags: PTagItem): LongWord; syscall ILayers 252;
+// 256 SetBackFillHookAttrs
+function GetBackFillHookAttrsA(Hook: PHook; Tags: PTagItem): LongWord; syscall ILayers 260;
+// 264 GetBackFillHookAttrs
+function ComposeLayersA(L: PLayer; Rect: PRectangle; TagList: PTagItem): LongWord; syscall ILayers 268;
+// 272 ComposeLayers
+function GetOffScreenLayerBitMap(L: PLayer; FallBack: PBitMap; Bounds: PRectangle): LongWord; syscall ILayers 276;
+function SetLayerInfoAttrsA(Li: PLayer_Info; TagList: PTagItem): LongWord; syscall ILayers 280;
+// 284 SetLayerInfoAttrs
+function GetLayerInfoAttrsA(Li: PLayer_Info; TagList: PTagItem): LongWord; syscall ILayers 288;
+// 292 GetLayerInfoAttrs
+function ChangeLayerAlpha(L: PLayer; Clips: PClipRect; Hook: PHook): PClipRect; syscall ILayers 296;
+function SetForegroundAlpha(L: PLayer; TemplatePtr: APTR; TemplateType, BytesPerRow: LongWord; Left, Top: LongInt; Width, Height, Flags: LongWord): LongWord; syscall ILayers 300;
+function SetLayerOpaqueness(L: PLayer; Opaqueness: LongWord): LongWord; syscall ILayers 304;
+function SetLayerOverlayRect(L: PLayer; Left, Top, Width, Height: LongInt; Flags: LongWord): LongWord; syscall ILayers 308;
+
+implementation
+
+const
+  // Change VERSION and LIBVERSION to proper values
+  LIBVERSION : longword = 0;
+
+initialization
+  LayersBase := OpenLibrary(LAYERSNAME, LIBVERSION);
+  if Assigned(LayersBase) then
+    ILayers := GetInterface(LayersBase, 'main', 1, nil);
+finalization
+  if Assigned(ILayers) then
+    DropInterface(ILayers);
+  if Assigned(LayersBase) then
+    CloseLibrary(LayersBase);
+end.
+
+
+