program surface;
{$path "ram:include/","pascal:include/"}
{$incl "intuition.lib","graphics.lib"}
 label 1,2;
 const
  pi=3.14
 type
  RPort=^RastPort
 var
  NWin:NewWindow;
  Gad3:Gadget;
  Img1,Img2:Image;
  Tex3:Intuitext;
  Rp,Rp1:^RastPort;
  Win1: ^Window;
  Msg: ^IntuiMessage;
  Scr:^Screen;
  i:integer;

procedure Line(Rp:RPort; x1,y1,x2,y2:integer);
 begin
  Move(Rp,x1,y1);Draw(Rp,x2,y2);
 end;

procedure PutWindow(Rp:RPort; x1,y1,x2,y2:integer);
  begin
    SetAPen(Rp,2);
    move(Rp,x1,y2);
    draw(Rp,x1,y1);
    draw(Rp,x2,y1);
    SetAPen(Rp,1);
    draw(Rp,x2,y2);
    draw(Rp,x1,y2);
  end;

begin
 OpenLib(GfxBase,'graphics.library',0);
 Scr:=Open_Screen(0,0,640,256,4,0,1,hires or genlock_video,'My Screen');
 SetRGB4(^Scr^.ViewPort,0,10,10,10);
 SetRGB4(^Scr^.ViewPort,1,0,0,0);
 SetRGB4(^Scr^.ViewPort,2,15,15,15);
 SetRGB4(^Scr^.ViewPort,3,7,7,7);
 Win1:=Open_Window(0,11,640,245,0,0,$800,nil,Scr,300,100,640,256);
   Gad3:=Gadget(Nil,           { dritte Gadget-Struktur: }
                200,25,        { Position }
                32,12,         { Größe }
                GADGHIMAGE+GADGIMAGE,    { Gadget hat Bild }
                RELVERIFY+TOGGLESELECT,  { Activation Flags }
                BOOLGADGET,    { Typ }
                ^Img1,         { Zeiger auf Imagestruktur }
                ^Img2,         { Select-Image }
                ^Tex3,         { Zeiger auf Text }
                0, Nil, 3, 0); { Nummer 3 }
   Tex3:=IntuiText(1, 0, 0, -100, 3, Nil, 'Mit Bild:', Nil);
   IDt1:=Ptr(Alloc_Mem(SizeOf(ImgDatTyp),2));
   IDt1^:=ImgDatTyp(%00000000000000000000000111000000,
                    %00000000000000000000111111111000,
                    %00000000000000000111111111111111,
                    %00000000000000000000001111100000,
                    %00000000000000000000001111100000,
                    %11111110000000000000001111100000,
                    %11111111110000000000011111100000,
                    %00000011111000000001111111000000,
                    %00000001111111111111111100000000,
                    %00000000011111111111100000000000,
                    %00000000000000000000000000000000,
                    %00000000000000000000000000000000);
   IDt2:=Ptr(Alloc_Mem(SizeOf(ImgDatTyp),2));
   IDt2^:=ImgDatTyp(%00000000000000000000000000000000,
                    %00000000000000000000000000000000,
                    %00000000011111111111100000000000,
                    %00000001111111111111111100000000,
                    %00000011111000000001111111000000,
                    %11111111110000000000011111100000,
                    %11111110000000000000001111100000,
                    %00000000000000000000001111100000,
                    %00000000000000000111111111111111,
                    %00000000000000000000111111111000,
                    %00000000000000000000001111100000,
                    %00000000000000000000000111000000);
   Img1:=Image(0,0,32,12,1,IDt1,1,3,Nil);
   Img2:=Image(0,0,32,12,1,IDt2,1,3,Nil);


 If Win1=Nil Then Error('Fenster kann nicht geöffnet werden!');

 Rp:=Win1^.RPort;
 PutWindow(Rp,10,5,630,80);
 Delay(1000);
 Close_Window(Win1);
 Close_Screen(Scr);
1:
2:
end.
















