PROGRAM Umrandung2;

{ Eine Umrandungsvariante, die statt mit Intuition- mit Graphikelementen
  arbeitet und dabei mehr Varianten eröffnet, wie z.B. dickere und
  unterschiedliche X- und Y-Rahmen.

  written 1992 by Andreas Neumann of NEUDELSoft                          }

{$I "Include:Intuition/Intuition.i" }
{$I "Include:Graphics/Graphics.i" }
{$I "Include:Graphics/Pens.i" }
{$I "Include:Exec/Ports.i" }
{$I "Include:Exec/Libraries.i" }

CONST
        wintitle : String = ("Tolle Effekte mit der Procedure 'Umrandung'");

        MyNewWindow : NewWindow = (0,0,640,200,-1,-1,
                                   CLOSEWINDOW_f,
                                   ACTIVATE +SMART_REFRESH+
                                   WINDOWCLOSE+RMBTRAP,
                                   NIL,NIL,wintitle,NIL,NIL,0,0,0,0,
                                   WBENCHSCREEN_f);

        gfxname : String = ("graphics.library");

VAR
    imes : IntuiMessagePtr;
    win  : WindowPtr;

PROCEDURE Line (w : WindowPtr; x1 , y1 , x2 , y2 , col : Short);

BEGIN
 SetAPen (w^.RPort,col);
 Move (w^.RPort,x1,y1);
 Draw (w^.RPort,x2,y2);
END;

PROCEDURE Umrandung (wo : WindowPtr; c1,c2,x,y,b,h,xstaerke,ystaerke : SHORT);

VAR um1 : Short;

BEGIN
 FOR um1:=0 TO xstaerke DO
 BEGIN
  Line (wo,x+um1,y+um1,x+um1,y+h-1-um1,c1);
  Line (wo,x+b-1-um1,y+um1,x+b-1-um1,y+h-1-um1,c2);
 END;
 FOR um1:=0 TO ystaerke DO
 BEGIN
  Line (wo,x+um1,y+um1,x+b-1-um1,y+um1,c1);
  Line (wo,x+um1,y+h-1-um1,x+b-1-um1,y+h-1-um1,c2);
 END;

END;


BEGIN
 GfxBase := OpenLibrary (gfxname,0);
 win:=OpenWindow (Adr(MyNewWindow));

 IF win<>NIL THEN
 BEGIN

  Umrandung(win,2,1,10,15,620,180,1,1);
  Umrandung(win,1,2,20,20,200,100,1,1);
  Umrandung(win,2,1,250,20,200,100,1,1);
  Umrandung(win,2,1,260,30,150,40,1,1);
  Umrandung(win,2,1,280,80,100,20,1,1);
  Umrandung(win,1,2,278,79,104,22,1,1);
  Umrandung(win,1,2,270,40,50,20,1,1);

  imes:=Address(WaitPort(win^.UserPort));
  imes:=Address(GetMsg(win^.UserPort));
  ReplyMsg(Address(imes));
  CloseWindow(win);
 END;

 CloseLibrary (GfxBase);
END.

