home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / demos / 275 / pascal / test.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-07-14  |  2.0 KB  |  102 lines

  1. PROGRAM Test;
  2.  
  3. {$I a:gemsubs.pas }
  4.  
  5. VAR
  6.     Other,    X, Y : Short_Integer ;
  7.     PValue, CIndex : Short_Integer ;
  8.     c : Char ;
  9.     TCol : Short_Integer;
  10.     PValuestring, CIndexstring, mystring :Str255 ;
  11.  
  12.  
  13. PROCEDURE StNum( VAR It : Str255; Other : Short_Integer ) ;
  14. VAR Temp1, Temp2 : Str255;
  15. BEGIN
  16.     Temp1 := Chr( ( Other DIV 10 ) + 48 ) ;
  17.     Temp2 := Chr( ( Other MOD 10 ) + 48 ) ;
  18.     It := Concat(Temp1, Temp2);
  19. END;
  20.  
  21. PROCEDURE Get_Pixel_Value( X, Y : Short_Integer ;
  22.                            VAR PV, CI : Short_Integer ) ;
  23.  
  24.     VAR
  25.         Ctrl : Ctrl_Parms ;
  26.         Int_In : Int_In_Parms ;
  27.         Int_Out : Int_Out_Parms ;
  28.         Pts_In : Pts_In_Parms ;
  29.         Pts_Out : Pts_Out_Parms ;
  30.  
  31.     BEGIN { Get_Pixel_Value }
  32.         
  33.         Ctrl[1] := 1 ;
  34.         Ctrl[3] := 0 ;
  35.         Pts_In[0] := X ;
  36.         Pts_In[1] := Y ;
  37.  
  38.         VDI_Call( 105, 0, 0, 2, Ctrl, Int_In, Int_Out,
  39.                   Pts_In, Pts_Out, False ) ;
  40.  
  41.         PV := Int_Out[0] ;
  42.         CI := Int_Out[1] ;
  43.  
  44.     END ; { Get_Pixel_Value }
  45.  
  46. PROCEDURE Test_Screen ;
  47.  
  48.     VAR
  49.         Index : Short_Integer ;
  50.         Cur_Col : Short_Integer ;
  51.         Offset : Short_Integer;
  52.  
  53.     BEGIN { Test_Screen }
  54.  
  55.         Clear_Screen ;
  56.         Set_Clip( 0, 0, 320, 200 ) ;
  57.         Line_Style( 1 ) ;
  58.         Draw_Mode( 1 ) ;
  59.         Cur_Col := 0 ;
  60.         Offset := 0 ;
  61.  
  62.         REPEAT
  63.  
  64.         FOR Index := 0 TO 10 DO
  65.                 BEGIN
  66.                     Line_Color( Cur_Col ) ;
  67.                     Line( 0, Index + Offset , 319, Index + Offset ) ;
  68.                 END ;
  69.         Cur_Col := Cur_Col + 1 ;
  70.         Offset := Offset + 12 ;
  71.         UNTIL Cur_Col = 16 ;
  72.     END ;
  73.  
  74. BEGIN { Main - Test }
  75.  
  76.     IF Init_Gem >= 0 THEN
  77.         BEGIN
  78.             Test_Screen ;
  79.             Y := 5 ;
  80.             X := 30 ;
  81.             TCol := 15 ;
  82.  
  83.             REPEAT
  84.                 Get_Pixel_Value( X, Y, PValue, CIndex ) ;
  85.                 Text_Color( TCol ) ;
  86.                 StNum( PValuestring, PValue ) ;
  87.                 StNum( CIndexstring, CIndex ) ;
  88.                 mystring := concat('Pixel Value = ',PValuestring,
  89.                                                         ' Col Index = ',CIndexstring);
  90.  
  91.                 Draw_String( X, Y, mystring) ;
  92.                 
  93.                 Read( c ) ;
  94.                 Y := Y + 12 ;
  95.                 TCol := TCol - 1 ;
  96.                 IF TCol = 0 THEN TCol := 1;
  97.             UNTIL Y >= 200 ;
  98.             Exit_Gem;
  99.  
  100.         END;
  101. END.
  102.