home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Amos / amproe2x.dms / in.adf / Compiler_Examples / AMOS_versions / Zoom.AMOS / Zoom.amosSourceCode
Encoding:
AMOS Source Code  |  1993-06-16  |  2.3 KB  |  119 lines

  1. ' ---------------------------------  
  2. '
  3. ' AMOSPro Compiler Example 
  4. '
  5. ' Real time Top-Zooming area 
  6. '
  7. ' By Jean-Baptiste BOLCATO 
  8. '
  9. ' (c) 1993 Europress Software Ltd. 
  10. '
  11. ' ---------------------------------  
  12. '
  13. ' -------------------------------------------------
  14. ' Remark: An AMOS coded flexible zoom routine  
  15. '
  16. '         Average Acceleration:  300 % 
  17. '
  18. '         Test configuration: A1200, 6Mb 
  19. '
  20. '         Original AMOS Compiler:  240 % 
  21. ' -------------------------------------------------
  22.  
  23. ' ---- Variables Init ---- 
  24.  
  25. Set Buffer 24
  26.  
  27. ' Time to loop 
  28. TL=500
  29. Dim PW(5)
  30. PW(1)=2 : PW(2)=4 : PW(3)=8
  31. PW(4)=16 : PW(5)=32
  32.  
  33. ' ---- Parameter screen ---- 
  34.  
  35. Screen Open 0,320,200,2,Lowres
  36. Palette 0,$FFF : Curs Off : Cls 0
  37. Paper 0 : Pen 1 : Ink 1 : Hide 
  38. Limit Mouse 0,0 To 80,80
  39. X Mouse=50 : P=1
  40. Home : Print "Use Mouse to choose a zoom power factor:";
  41. Repeat 
  42.    Ink 0 : Box 160-32/P,100-128/P To 160+32/P,100+128/P
  43.    P=1+(X Mouse/16) : If P<1 : P=1 : End If : If P>5 : P=5 : End If 
  44.    P=PW(P)
  45.    Ink 1 : Box 160-32/P,100-128/P To 160+32/P,100+128/P
  46.    Wait Vbl 
  47. Until Mouse Click
  48.  
  49. ' size of zoom: 16 multiple    
  50. W=64/P : H=256/P
  51.  
  52. ' ---- Screen init ----
  53.  
  54. Load Iff "AMOSPro_Extras:Compiler_Examples/Graphics/demo_pic.iff",0
  55. Screen Display 0,128,45,,
  56. Cls 0,320-68,0 To 320,256
  57.  
  58. ' ---- Main loop ----
  59.  
  60. Limit Mouse 129,46 To 320+128-68,45+200-H-1
  61. XZ=320-W*P
  62.  
  63. ' Xor writing
  64. Gr Writing 2 : Ink 0
  65. XM=260 : YM=1
  66. Draw XM,YM To XM+W,YM
  67. Draw To XM+W,YM+H
  68. Draw To XM,YM+H
  69. Draw To XM,YM+1
  70.  
  71. NL=0 : Timer=0
  72.  
  73. Repeat 
  74.    
  75.    XM_OLD=XM
  76.    YM_OLD=YM
  77.    XM=X Mouse-128
  78.    YM=Y Mouse-45
  79.    
  80.    ' Xor writing  
  81.    Gr Writing 2 : Ink 0
  82.    Draw XM_OLD-1,YM_OLD-1 To XM_OLD+W,YM_OLD-1
  83.    Draw To XM_OLD+W,YM_OLD+H
  84.    Draw To XM_OLD-1,YM_OLD+H
  85.    Draw To XM_OLD-1,YM_OLD
  86.    
  87.    Draw XM-1,YM-1 To XM+W,YM-1
  88.    Draw To XM+W,YM+H
  89.    Draw To XM-1,YM+H
  90.    Draw To XM-1,YM-1
  91.    
  92.    ' Normal writing 
  93.    Gr Writing 0
  94.    
  95.    ' Display zoom from pixel buffer 
  96.    For I=0 To W-1
  97.       For J=0 To H-1
  98.          Cls Point(XM+I,YM+J),XZ+I*P,J*P To XZ+(I+1)*P,(J+1)*P
  99.       Next J
  100.    Next I
  101.    
  102.    Wait Vbl 
  103.    
  104.    Inc NL
  105.    
  106. Until Timer>=TL
  107. T#=Timer
  108.  
  109. ' --- Final Report --- 
  110.  
  111. Autoback 1 : Cls 0 : Paper 0 : Pen 1
  112. Print "  Needs";T#/50;" seconds for";NL;" loops."
  113. Print "          ( =";T#/NL;" VBLs )"
  114. Print 
  115. Print "   Press mouse key to end"
  116. Repeat 
  117.    Multi Wait 
  118. Until Mouse Key or(Inkey$<>"")
  119. End