/* 
** $VER: Neon 2.0, IE Arexx script
** Image Engineer Macro script
** © by Patrik M Nydensten 
** 8/11 1996 Stockholm/Sweden
**
** Creates neon light lines out of image's color edges.
**
** 20/1/97 FORM interface added and algorithm replaced.
**         Sorry Patrik. sbe
*/

Options results
Signal on error         /* Setup a place for errors to go */

if arg()==0 then exit

'FORM "Neon" "Ok|Cancel"',
'INTEGER,"Size:",1,25,5,SLIDER',
'CHECKBOX,"Highlight original",0'

parse var result ok thick highlight

if ok=0 then exit

'MAXIMUM' arg(1) thick thick
maximage=Result

'MINIMUM' arg(1) thick thick
minimage=Result

'MARK' maximage 'PRIMARY'
'MARK' minimage 'SECONDARY'
'COMPOSITE 0 0 DIFFERENCE'
edgeimage=Result
'CLOSE' maximage
'CLOSE' minimage

if highlight=1 then do
    'MARK' arg(1) 'PRIMARY'
    'MARK' edgeimage 'SECONDARY'
    'COMPOSITE 0 0 ADD'
    'CLOSE' edgeimage
end

exit


/*******************************************************************/
/* This is where control goes when an error code is returned by IE */
/* It puts up a message saying what happened and on which line     */
/*******************************************************************/
error:
if RC=5 then do         /* Did the user just cancel us? */
    IE_TO_FRONT
    LAST_ERROR
    'REQUEST "'||RESULT||'"'
    exit
end
else do
    IE_TO_FRONT
    LAST_ERROR
    'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
    exit
end
