home *** CD-ROM | disk | FTP | other *** search
- REM @(#)CADKEY SOLIDS color.cdl 2.4 10/31/88
- REM @(#)SOLIDS SYNTHESIS color.cdl 3.02 1/25/88
-
- REM " Program to dynamically change the color palette for CADKEY SOLIDS"
- REM " R.H. LaRochelle 11-19-87 "
- array colors[3][1]
- if ( sizeof(colran) != 0 )
- goto defined
- array colran[9][6] = { \
- 1, 2, 15, 1.0, 1.0, 1.0, \
- 1, 16, 55, 1.0, 0.0, 0.0, \
- 2, 56, 95, 0.0, 1.0, 0.0, \
- 3, 96, 135 , 0.0, 0.0, 1.0,\
- 4, 136, 175, 0.0, 1.0, 1.0,\
- 5, 176, 215, 1.0, 0.0, 1.0,\
- 6, 216, 255, 1.0, 1.0, 0.0, \
- 7, 1, 15, 1.0, 1.0, 1.0,\
- 8, 1, 15, 1.0, 0.0, 0.0 }
- :defined
- array rgbcol [7][3] = { \
- 1,0,0, \
- 0,1,0, \
- 0,0,1, \
- 0,1,1, \
- 1,0,1, \
- 1,1,0, \
- 1,1,1 }
- palnum = 0
- bgred = 0.0
- bggreen = 0.0
- bgblue = 0.0
- inc = .1
- inc_intens = 0.05
- from_class = 0
- indcl = 1
- olcol = colran[indcl][0]
- stcol = colran[indcl][1]
- endcol = colran[indcl][2]
- red = colran[indcl][3]
- green = colran[indcl][4]
- blue = colran[indcl][5]
- :mainmenu
- from_class = 0
- getmenu "COLOR: Choose option",\
- "CLASS",\
- "COLOR",\
- "INTENS",\
- "RANGE",\
- "BACKGD",\
- "DONE"
-
- on (@key+3) goto leave_it,leave_it,mainmenu,,\
- classmenu,\
- colormenu,\
- intensmenu,\
- getst ,\
- bgmix,\
- leave_it
- goto mainmenu
- :classmenu
- getmenu "COLOR: Choose class ",\
- "CLASS1",\
- "CLASS2",\
- "CLASS3",\
- "CLASS4",\
- "CLASS5",\
- "CLASS6",\
- "CLASS7",\
- "CLASS8"
-
- on (@key+3) goto leave_it,mainmenu,classmenu,,\
- class,class,class,class,class,class,class,class \
- goto mainmenu
-
- :bgmix
- if ( @numpal >= 17 )
- goto okbg
- pause "Not supported for this graphics card ... hit RETURN"
- goto mainmenu
- :okbg
- rgb = 0
- :setpal
- colors[0][0] = bgred
- colors[1][0] = bggreen
- colors[2][0] = bgblue
- palette 0, 1, colors
-
- :getkey
- prompt "BKGD : Select color (R,G,B) ; define intensity "
- getkey
- if (@key == 0)
- goto getkey
- if (@key == 27)
- goto leave_it
- if (@key == 68)
- goto mainmenu
- if ((@key == 72) || (@key == 80))
- goto change
- if (@key == 114)
- rgb = 0
- if (@key == 103)
- rgb = 1
- if (@key == 98)
- rgb = 2
- if (@key == 73)
- inc = inc * 2
- if (@key == 81)
- inc = inc / 2
- goto getkey
-
- :change
- inc1 = inc
- if (@key == 80)
- inc1 = -inc
- on rgb goto r, g, b
- :r
- bgred = bgred + inc1
- if (bgred > 1.0)
- bgred = 1.0
- if (bgred < 0.0)
- bgred = 0.0
- goto setpal
- :g
- bggreen = bggreen + inc1
- if (bggreen > 1.0)
- bggreen = 1.0
- if (bggreen < 0.0)
- bggreen = 0.0
- goto setpal
- :b
- bgblue = bgblue + inc1
- if (bgblue > 1.0)
- bgblue = 1.0
- if (bgblue < 0.0)
- bgblue = 0.0
- goto setpal
-
- :class
- indcl = @key
- olcol = colran[indcl][0]
- stcol = colran[indcl][1]
- endcol = colran[indcl][2]
- red = colran[indcl][3]
- green = colran[indcl][4]
- blue = colran[indcl][5]
- from_class = 1
- goto colormenu
-
-
- :getst
- tmp = stcol
- getint "Enter starting color number (%d) =>", tmp , stcol
- if ((stcol > 0) && (stcol <= 255))
- goto okst
- pause "Invalid start color...press RETURN "
- stcol = tmp
- goto getst
- :okst
- if (@key == -2)
- goto mainmenu
- if (@key == -3)
- goto leave_it
-
- :getend
- tmp = endcol
- getint "Enter ending color number (%d) =>", tmp ,endcol
- if ((endcol >= stcol) && (endcol <= 255))
- goto okend
- pause "Invalid end color...press RETURN "
- endcol = tmp
- goto getend
- :okend
- if (@key == -2)
- goto getst
- if (@key == -3)
- goto leave_it
-
- :colormenu
-
- getmenu "COLOR: Choose color",\
- "RED",\
- "GREEN",\
- "BLUE",\
- "CYAN", \
- "MAGENTA",\
- "YELLOW",\
- "WHITE"
-
- if ( from_class == 1 )
- goto frclass
- on (@key+3) goto leave_it,mainmenu,colormenu,, \
- strcol, strcol, strcol, strcol, strcol, strcol, strcol
- goto mainmenu
- :frclass
- if ( from_class == 1 )
- on (@key+3) goto leave_it,classmenu,colormenu,, \
- strcol, strcol, strcol, strcol, strcol, strcol, strcol
- goto mainmenu
- :strcol
- ind = @key - 1
- colran[indcl][3] = rgbcol[ind][0]
- colran[indcl][4] = rgbcol[ind][1]
- colran[indcl][5] = rgbcol[ind][2]
- red = colran[indcl][3]
- green = colran[indcl][4]
- blue = colran[indcl][5]
- goto setrange
-
- :setrange
- ncol = endcol-stcol+1
- i = 0
- sred = 0.0
- sgreen = 0.0
- sblue = 0.0
- ered = 0.0
- egreen = 0.0
- eblue = 0.0
- sred = ( (2.0^(1/ncol)) - 1.0 ) * red
- sgreen = ( (2.0^(1/ncol)) - 1.0 ) * green
- sblue = ( (2.0^(1/ncol)) - 1.0 ) * blue
- ered = red
- egreen = green
- eblue = blue
- prange stcol,ncol,sred,sgreen,sblue,ered,egreen,eblue
- if ( @numpal < 17 )
- REDRAW
- goto colormenu
-
- :intensmenu
- ncol = endcol - stcol + 1
- start_intens = 2.0^(1/ncol) - 1.0
- end_intens = 1.0
- abs_start = start_intens
- abs_end = end_intens
- :gkk
- prompt "INTENS : Change intensity of current color class"
- getkey
- if ( @key == 0 )
- goto gkk
- if (@key == 27 )
- goto leave_it
- if (@key == 68 )
- goto mainmenu
- if (( @key == 72 ) || ( @key == 80 ))
- goto chnintens
- if (@key == 73)
- inc_intens = inc_intens * 2
- if (@key == 81)
- inc_intens = inc_intens / 2
- goto gkk
- :chnintens
- if ( @key == 80 )
- goto darker
- if ( end_intens == abs_end )
- goto light1
- end_intens = end_intens + inc_intens
- goto st
- :light1
- start_intens = start_intens + inc_intens
- if ( start_intens > 1.0 )
- start_intens = 1.0
- goto st
- :darker
- if (start_intens == abs_start )
- goto dark1
- start_intens = start_intens - inc_intens
- goto st
- :dark1
- end_intens = end_intens - inc_intens
- if ( end_intens < 0.0 )
- end_intens = 0.0
- :st
- sred = 0.0
- sgreen = 0.0
- sblue = 0.0
- ered = 0.0
- egreen = 0.0
- eblue = 0.0
- sred = start_intens * red
- sgreen = start_intens * green
- sblue = start_intens * blue
- ered = end_intens * red
- egreen = end_intens * green
- eblue = end_intens * blue
- prange stcol,ncol,sred,sgreen,sblue,ered,egreen,eblue
- if ( @numpal < 17 )
- REDRAW
- goto gkk
- goto mainmenu
-
- :leave_it
- clear palnum,bgred,bggreen, bgblue,red,blue,green,inc,olcol,stcol,endcol
- clear start_intens,end_intens,inc_intens,abs_start,abs_end,ncol
- clear theinc,tmp,rgbcol[8][3]
-