#! /usr/NeWS/bin/psh % % This file is a product of Sun Microsystems, Inc. and is provided for % unrestricted use provided that this legend is included on all tape % media and as a part of the software program in whole or part. % Users may copy, modify or distribute this file at will. % % THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE % WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR % PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. % % This file is provided with no support and without any obligation on the % part of Sun Microsystems, Inc. to assist in its use, correction, % modification or enhancement. % % SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE % INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE % OR ANY PART THEREOF. % % In no event will Sun Microsystems, Inc. be liable for any lost revenue % or profits or other special, indirect and consequential damages, even % if Sun has been advised of the possibility of such damages. % % Sun Microsystems, Inc. % 2550 Garcia Avenue % Mountain View, California 94043 % % Copyright (c) 1988 by Sun Microsystems, Inc. systemdict /Item known not { (NeWS/liteitem.ps) run } if /LabelFont /Times-Bold findfont 14 scalefont def /barWidth 256 def /barHeight 30 def /range 100 def /red 1 def /blu 1 def /gre 1 def /paintBox { can setcanvas gsave 338 75 63 63 rectpath red blu gre setrgbcolor fill grestore} def /notify { (Notify: Value=%) [ItemValue] /printf messages send } def /setNP {/DefaultRootGrayOrColor red blu gre rgbcolor store PaintRoot} def /redNP { /red ItemValue range div store paintBox paintBlu paintGre} def /bluNP { /blu ItemValue range div store paintBox paintRed paintGre} def /greNP { /gre ItemValue range div store paintBox paintRed paintBlu} def /FillColor 1 1 1 rgbcolor def /paintRGB { paintRed paintBlu paintGre } def /paintRed { items /RedSlide get /ItemCanvas get setcanvas 0 1 barWidth { /x exch def /val x barWidth div def x 2 add 0 moveto val blu gre rgbcolor setcolor 0 22 rlineto stroke } for } def /paintBlu { items /BluSlide get /ItemCanvas get setcanvas 0 1 barWidth { /x exch def /val x barWidth div def x 2 add 0 moveto red val gre rgbcolor setcolor 0 22 rlineto stroke } for } def /paintGre { items /GreSlide get /ItemCanvas get setcanvas 0 1 barWidth { /x exch def /val x barWidth div def x 2 add 0 moveto red blu val rgbcolor setcolor 0 22 rlineto stroke } for } def /createitems { /items 50 dict dup begin /setButton (set) /setNP can 63 63 /new ButtonItem send dup /ItemBorderColor .5 .5 .5 rgbcolor put 338 3 /move 3 index send def /RedSlide () [0 range range] /Top /redNP can barWidth barHeight /new SliderItem send 73 103 /move 3 index send def /BluSlide () [0 range range] /Top /bluNP can barWidth barHeight /new SliderItem send 73 53 /move 3 index send def /GreSlide () [0 range range] /Top /greNP can barWidth barHeight /new SliderItem send 73 3 /move 3 index send def end def } def /main { /win framebuffer /new LiteWindow send def % Create a window { /FrameLabel (R B G B a c k g r o u n d) def /PaintClient { gsave FillColor fillcanvas items paintitems LabelFont setfont 0 setgray 5 105 moveto (Red) show 5 55 moveto (Blue) show 5 5 moveto (Green) show paintBox paintRGB stroke grestore } def } win send % Install my stuff. % 200 200 412 155 /reshape win send % Shape it. 200 200 452 175 /reshape win send % Shape it. /can win /ClientCanvas get def % Get the window canvas createitems /map win send % Map the window & install window event manager. /itemmgr items forkitems def } def main