/* v1.29 Visual Gradient Marko Seppänen marko.seppanen@wwnet.fi */ address IMAGEENGINEER Options results signal on error /* Setup a place for errors to go */ if arg()=0 then exit x=arg(1) parse var x pic bartype direction gammavalue arguments arguments=strip(arguments,B) MARK pic PRIMARY PROJECT_INFO pic WIDTH picwidth=result PROJECT_INFO pic HEIGHT picheight=result PROJECT_INFO pic ZOOM origzoomvalue=result if bartype="" then do if exists("ie:prefs/visualtexturebar.cfg") == "1" then do call open("temp","ie:prefs/visualtexturebar.cfg","R") values=readln("temp") parse var values ok bartype direction gammavalue . call close("temp") end else do bartype=0 direction=0 gammavalue=0 end ' FORM "Visual TextureBar" "Use|Cancel"', ' CYCLE,"Bartype","Sunshine|Night|LightColor|DarkColor|Psycho",'bartype'', ' CYCLE,"Direction","Right|Bottom|Left|Top",'direction'', ' INTEGER,"Gammavalue",-100,100,'gammavalue',SLIDER' values=result parse var values ok bartype direction gammavalue . if ok = 0 then exit call open("temp","ie:prefs/visualtexturebar.cfg","W") res=writeln("temp",values) call close("temp") end OPEN "ie:alpha/gradient.alpha" COLOUR grad=result PROJECT_SET grad ZOOM origzoomvalue if direction=="0" | upper(direction)=="RIGHT" then degree=180 if direction=="1" | upper(direction)=="BOTTOM" then degree=90 if direction=="2" | upper(direction)=="LEFT" then nodegree=1 if direction=="3" | upper(direction)=="TOP" then degree=270 if nodegree~="1" then do ROTATE grad degree FAST rotgrad=result CLOSE grad end else rotgrad=grad SCALE rotgrad picwidth picheight BEST grad2=result CLOSE rotgrad GAMMA grad2 gammavalue RED GREEN BLUE gammagrad=result CLOSE grad2 select when bartype == 0 | upper(bartype) == "SUNSHINE" then do REFLECT_X gammagrad grad3=result CLOSE gammagrad MARK pic PRIMARY MARK pic ALPHA MARK grad3 SECONDARY COMPOSITE 0 0 ADD final=result CLOSE grad3 end when bartype == 1 | upper(bartype) == "NIGHT" then do MARK pic PRIMARY MARK pic ALPHA MARK gammagrad SECONDARY COMPOSITE 0 0 MULTIPLY final=result CLOSE gammagrad end when bartype == 2 | upper(bartype) == "LIGHTCOLOR" then do if exists("ie:arexx/primarycolors.rexx") == "0" then do 'REQUEST "Please install latest version of Image Engineer!" "OK"' exit end parse var arguments pcolor if upper(pcolor) == "PCOLOR" then pcolor="" address command "Sys:Rexxc/rx ie:arexx/PrimaryColors.rexx" gammagrad pcolor PROJECT_LIST xyz=result colorgrad=subword(xyz,1,1) CLOSE gammagrad MARK pic PRIMARY MARK pic ALPHA MARK colorgrad SECONDARY COMPOSITE 0 0 MAX final=result CLOSE colorgrad end when bartype == 3 | upper(bartype) == "DARKCOLOR" then do if exists("ie:arexx/primarycolors.rexx") == "0" then do 'REQUEST "Please install latest version of Image Engineer!" "OK"' exit end parse var arguments pcolor if upper(pcolor) == "PCOLOR" then pcolor="" address command "Sys:Rexxc/rx ie:arexx/PrimaryColors.rexx" gammagrad pcolor PROJECT_LIST xyz=result colorgrad=subword(xyz,1,1) CLOSE gammagrad MARK pic PRIMARY MARK pic ALPHA MARK colorgrad SECONDARY COMPOSITE 0 0 MULTIPLY final=result CLOSE colorgrad end when bartype == 4 | upper(bartype) == "PSYCHO" then do if exists("ie:arexx/primarycolors.rexx") == "0" then do 'REQUEST "Please install latest version of Image Engineer!" "OK"' exit end parse var arguments pcolor if upper(pcolor) == "PCOLOR" then pcolor="" address command "Sys:Rexxc/rx ie:arexx/PrimaryColors.rexx" gammagrad pcolor PROJECT_LIST xyz=result colorgrad=subword(xyz,1,1) CLOSE gammagrad MARK pic PRIMARY MARK pic ALPHA MARK colorgrad SECONDARY COMPOSITE 0 0 DIFFERENCE final=result CLOSE colorgrad end otherwise exit 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