From: CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 3-MAR-1989 06:14 To: MRGATE::"ARISIA::EVERHART" Subj: RE: Help! Need to display grey-scale images on VS2000! Received: From KL.SRI.COM ([0.0.0.0]) by CRVAX.SRI.COM with TCP; Fri, 3 MAR 89 02:32:40 PDT Received: from NSS.Cs.Ucl.AC.UK by KL.SRI.COM with TCP; Fri, 3 Mar 89 02:09:30 PST Received: from vaxb.rhbnc.ac.uk by NSS.Cs.Ucl.AC.UK via Janet with NIFTP id aa05125; 3 Mar 89 9:45 GMT Date: 3-MAR-1989 09:56:20 GMT From: UHAP058%vaxb.rhbnc.ac.uk@NSS.Cs.Ucl.AC.UK To: Info-Vax <@NSS.Cs.Ucl.AC.UK:Info-Vax@kl.sri.com> Subject: RE: Help! Need to display grey-scale images on VS2000! Sender: "JANET UHAP058@UK.AC.RHBNC.VAXB" Message-Id: <20A02E49_00097F84.009213237F37C420$18_1@UK.AC.RHBNC.VAXB> Originally-to: $INFO-VAX Originally-from:UHAP058 "Zahid Hussain" Mailer: Janet_Mailshr V3.3a (02-Feb-1989) Dear INFO_VAX, I think the problem Rick McTeague mentions with UIS$IMAGE arise from probably not setting the writing mode (UIS$SET_WRITING_MODE). The attribute block 0 has defaults which makes it work for a mono WS, however for a color WS, this attribute block has to be modified. For example, the following code (in PASCAL) should work. First, assume you have the following image definition: const xsize = 255; ysize = 255; type image = array [0..xsize,0..ysize] of integer; (* The image is a 256x256 array of integer, modify this to the size you need and the virtual display and viewport *) First get the hardware information: UIS$GET_DISPLAY_SIZE('SYS$WORKSTATION',ws_xwidth,ws_ywidth,xres,yres); UIS$GET_HW_COLOR_INFO('SYS$WORKSTATION',,indices); Next crete the virtual display and viewport: vd_id := uis$create_display(0,0,xsize,ysize,(xsize+1)/xres, (ysize+1)/yres,vcm_id); wd_id := uis$create_window(vd_id,'SYS$WORKSTATION','PICTURE'); indices will tell you the number of color or grey level you can have. NExt create a color map (UIS$CREATE_COLOR_MAP) and load it with a color map using either (UIS$SET_COLOR or UIS$SET_COLORS). Having done all this, you can display the image using the following procedure. procedure display_color_image(vd_id, wd_id : unsigned; var im : image); var i,j : integer; buffer: packed array [0..xsize,0..ysize] of byte; begin uis$set_writing_mode(vd_id,0,1,uis$c_mode_copy); for i := 0 to xsize do for j := 0 to ysize do if (im[i,j] > 249) then buffer[j,i] := 249 else if (im[i,j] < 0) then buffer[j,i] := 252 else buffer[j,i] := (im[i,j]) :: byte; uisdc$image(wd_id,1,0,0,xsize,ysize,xsize+1,ysize+1,8,buffer); end; Hope, this helps. Enjoy! ** Zahid. Zahid Hussain, Ph.D. Royal Holloway & Bedford New College, University of London, Dept. of Physics, E-mail : JANET: UHAP058@uk.ac.rhbnc.vaxb Egham Hill, Egham BITNET/EARN: UHAP058@vaxb.rhbnc.ac.uk England, U.K.