PROGRAM   CtrlGeIm ;
USES   Graph ;

VAR
   G_ImageSize1 : Longint ;
   G_ImagePtr1  : Pointer ;
VAR
   G_ImageSize2 : Longint ;
   G_ImagePtr2  : Pointer ;

VAR
   G_GraphDriver : Integer ;
   G_GraphMode   : Integer ;
BEGIN
   G_GraphDriver := Detect ;
   G_GraphMode   := Detect ;
   InitGraph ( G_GraphDriver , G_GraphMode , 'C:\Lib\BGI' );

   SetFillStyle ( SolidFill , White );
   Bar ( 0,0  ,  100,50 );
   SetColor ( Black );
   MoveTo ( 0,0 );   LineTo ( 100,50 );
   MoveTo ( 0,50 );   LineTo ( 100,0 );
   Circle ( 50,25  , 20 );

   SetFillStyle ( InterLeaveFill , White );
   Bar ( 200,0  ,  300,50 );
   SetColor ( Black );
   MoveTo ( 200+1,0+1 );   LineTo ( 300-1,50-1 );
   MoveTo ( 200+1,50+1 );   LineTo ( 300-1,0-1 );
   Circle ( 250,25  , 10 );

   G_ImageSize1 := ImageSize ( 0,0  ,  100,50 );
   G_ImageSize2 := ImageSize ( 200,0  ,  300,50 );
   GetMem ( G_ImagePtr1 , G_ImageSize1 );
   GetMem ( G_ImagePtr2 , G_ImageSize2 );

   GetImage ( 0,0  ,  100,50  , G_ImagePtr1^ );
   GetImage ( 200,0  ,  300,50  , G_ImagePtr2^ );

   PutImage ( 60,60  , G_ImagePtr1^ , NormalPut );
   PutImage ( 260,60  , G_ImagePtr2^ , NormalPut );

   FreeMem ( G_ImagePtr1 , G_ImageSize1 );
   FreeMem ( G_ImagePtr2 , G_ImageSize2 );

   ReadLn ;
END.
