home *** CD-ROM | disk | FTP | other *** search
- /* Program to use ADPro to separate a picture into a selected number of colours, suitable for screen printing. */
-
- trace r
-
- options results
- address "ADPro"
- getfile '"Select picture to process"'
- if rc=10 then exit
- filename = ADPro_Result
- getdir '"Select where to save results"'
- if rc=10 then exit
- outdirectory = strip(ADPro_Result)
- if right(outdirectory,1)~= ":" then outdirectory = outdirectory"/"
-
-
- address "ADPro"
-
- lformat "UNIVERSAL"
- sformat "IFF"
-
- /* Use the current screen format. */
-
- screen_type
- stype = ADPro_result
-
- /* Here is where you ask the user for figures */
-
- getnumber '"How many inks?"' 4 2 256
- colours = ADPro_result
- if rc~=0 then colours = 0
- if colours>256 then colours = 256
-
- colon = lastpos('/', filename)
- if colon = 0 then colon = pos(':', filename)
- if colon = 0 then do
- path = ""
- filebase = filename
- end
- else do
- path =left(filename, colon)
- filebase = substr(filename,colon+1)
- end
-
- pstatus unlocked
- load filename
-
- ptotal 256
- poffset 0
- pused colours
- if colours<33 then newtotal = 32
- if colours<17 then newtotal = 16
- if colours<9 then newtotal = 8
- if colours<5 then newtotal = 4
- ptotal newtotal
- render_type "CUST"
- dither 6 /* Random dither */
- execute
- pstatus locked
- psave "ram:palette"
- do i = 0 to colours-1
- ppoke i
- pcolours.i = ADPRO_RESULT
- end
-
- /* Construct a name for the new file and save it */
- newname = outdirectory||filebase||".all"
- save newname "IMAGE"
- if rc~=0 then do
- okay1 '"Trouble saving file "||newname'
- exit
- end
-
- /* Set palette to all white */
- do i = 0 to colours-1
- ppoke i 255 255 255
- end
-
- /* Set each colour in turn to black and save picture */
- do i = 0 to colours-1
- ppoke i 0 0 0
- /* Construct a name for the new file and save it */
- filenumber = right(i,3,"0")
- newname = outdirectory||filebase||"."||filenumber
- save newname "IMAGE"
- if rc~=0 then do
- okay1 '"Trouble saving file "||newname'
- exit
- end
- ppoke i 255 255 255
- end
-
- pused 2
- ptotal 2
- ppoke 0 0 0 0
- do i= 0 to colours-1
- /* Construct a name for the file, load it and resave it as 1 bitplane */
- filenumber = right(i,3,"0")
- newname = outdirectory||filebase||"."||filenumber
- load newname
- render_type "CUST"
- res = RC
- execute
- save newname "IMAGE"
- if rc~=0 then do
- okay1 '"Trouble saving file "||newname'
- exit
- end
- end
- trace r
- /* Make a colour chart */
- screen_type 4
- dither 0
- pstatus "UNLOCKED"
- render_type 32 /* This could be changed to 256 if you have AGA. HAM & EHB don't seem to work. */
- res = RC
-
- lformat "BACKDROP"
- load "X" 320 256 "COLOR" 140 140 140
- operator "TEXT_VISUAL" font_type "BITMAPPED" font_dir "fonts:" font_name "TOPAZ" emboss_direction "OFF" render_type "MIX" set_colors 0 0 0 set_font_size 11 set_blur "-1" set_render 100 set_yoffset 12 string '"INK COLOUR CHART"' center_xoffset draw
- le = 2
- te = 42
- j = 1
- do i = 0 to 23
- if i = colours then break
- operator "RECTANGLE" le te 36 64 "-1" pcolours.i
- le = le+40
- j = j+1
- if j = 9 | j= 17 then do
- le = 2
- te = te+68
- end
- end
-
- execute
- /* Construct a name for the chart file and save it */
- newname = outdirectory||filebase||".chart"
- save newname "IMAGE"
- if rc~=0 then do
- okay1 '"Trouble saving file "||newname'
- exit
- end
-
- lformat "UNIVERSAL"
- ADPRO_TO_FRONT
- exit_msg("Done")
- end
-
- /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
-
- error:
- syntax:
- do
- exit_msg("Arexx program failed due to error: "errortext(rc))
- end
-
- exit_msg:
- do
- parse arg message
- if message ~= "" then
- okay1 message
- exit
- end