home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Graphics / PerfectPaint / rexx / general / LoadADPro_Picture.rx < prev    next >
Text File  |  1999-12-10  |  2KB  |  129 lines

  1. /* LoadAdpro Picture*/
  2.  
  3.     options results
  4.     parse ARG Port b
  5.  
  6.     IF ~SHOW('P','ADPro') THEN
  7.         DO
  8.             ADDRESS value Port
  9.         pp_Warn "Can't*locate*ADPro"
  10.       EXIT
  11.         END
  12.  
  13.     p=1
  14.     d=0
  15.     c=0
  16.  
  17.     ADDRESS COMMAND
  18.     sens=0
  19.     if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/LoadADPro_Picture') THEN DO
  20.         IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/LoadADPro_Picture', "R") then DO
  21.             p = READLN('lfile')
  22.             d = READLN('lfile')
  23.             c = READLN('lfile')
  24.             CALL CLOSE('lfile')
  25.         END
  26.     END
  27.  
  28.     ADDRESS value Port
  29.         pp_GetDepth
  30.         if result=24 then DO
  31.             a=24
  32.         END
  33.         else DO
  34.             a=2**result
  35.         END
  36.  
  37.     IF a~=24 then DO
  38.         pp_DialogInit 250 100 "*Load*ADPro*Picture*" 3
  39.             pp_Cycle 0 80 7 130 16 "Palette" 1 "New*Palette|Current*Palette" p
  40.             pp_Cycle 1 80 27 130 16 "Dithering" 1 "No|Floyd" d
  41.             pp_Cycle 2 80 47 130 16 "Colors" 1 "Current*Depth|2|4|8|16|32|64|128|256" c
  42.         pp_Dialog    
  43.  
  44.         rc=result
  45.         if rc=0 then
  46.             do
  47.                 EXIT
  48.             end    
  49.  
  50.         pp_GetDialog 0
  51.         p=result
  52.  
  53.         pp_GetDialog 1
  54.         d=result
  55.  
  56.         pp_GetDialog 2
  57.         c=result    
  58.  
  59.         CALL SavePrefs('LoadADPro_Picture',p,d,c)
  60.         c=2**c
  61.  
  62.         ADDRESS value Port
  63.  
  64.         pp_Psave 'ram:t/ppptemp'
  65.  
  66.         IF c=1 THEN
  67.             DO
  68.                 c=a
  69.             END
  70.         ENDIF
  71.         
  72.         ADDRESS 'ADPro'
  73.         ADPRO_TO_FRONT
  74.         AVAIL_MODES_ONLY OFF
  75.         IF p=0 THEN
  76.             DO
  77.                 PSTATUS "UNLOCKED"
  78.             END
  79.             ELSE
  80.             DO
  81.                 PLOAD 'ram:t/ppptemp'
  82.                 PSTATUS "LOCKED"
  83.             END
  84.  
  85.         SFORMAT "IFF"
  86.     SCREEN_TYPE "NONINTERLACED"
  87.         RENDER_TYPE c
  88.         DITHER d
  89.         EXECUTE
  90.         SAVE 'ram:t/pptemp' "IMAGE"
  91.     END
  92.     ELSE
  93.     DO
  94.         ADDRESS 'ADPro'
  95.         ADPRO_TO_FRONT
  96.         SAVE 'ram:t/pptemp' "RAW"
  97.     END
  98.  
  99.     ADDRESS value Port
  100.         pp_ShowScreen
  101.         pp_Load 'ram:t/pptemp'
  102.  
  103.     ADDRESS COMMAND
  104.         'delete >nil: ram:t/pptemp'
  105.         if a~=24 then DO
  106.             'delete >nil: ram:t/ppptemp'
  107.         END
  108.  
  109. EXIT
  110.  
  111. SavePrefs: PROCEDURE
  112.     
  113.     Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  114.  
  115.     if EXISTS(Prefname) THEN DO
  116.         ADDRESS COMMAND
  117.         'delete >nil: '||Prefname
  118.     END
  119.  
  120.     IF OPEN('pfile',PrefName,'W') THEN DO
  121.  
  122.     do i=2 to ARG()
  123.         CALL WRITELN('pfile',ARG(i))
  124.     end
  125.  
  126.     CALL CLOSE('pfile')
  127.  
  128. RETURN
  129.