pro annotation_image, outbasename, xsize, ysize, text, gif=gif, x=x, y=y, size=size,color=mycolor ; Bo Milvang-Jensen (milvang@astro.ku.dk) ; For the RelViz Web exhibition, June 1996 ; Last rev.: 09-Jun-1996 ; This procedure produces an image (GIF or IRIS) of size xsize by ysize ; with the text text of size size placed at relative position x,y ; Color (RGB) is color. ; Note: one needs fromgif(6D) unless one wants a GIF image. ; The output IRIS image can be added to another one using add(6D) ; The image size can be found using imgsize(6D) ; Set defaults: default, gif, 0 ; Default is to make an IRIS (*.rgb) image default, x, 0.65 default, y, 0.05 default, size, 1.3 default, mycolor, [1.0, 1.0, 1.0] ; Default color is white ; Calculate integer color values, i.e. map [0.0,1.0] to [0,255]. ; Note: If we had called our variable color and not mycolor, we would have ; got trouble because there's a function called color as well icolor = bytarr(3) icolor = fix(mycolor*255) ; Note: array expression ; Make invisible window with the right size: window, 1, /pix, xsize=xsize, ysize=ysize ; Write the text to the invisible window. ; We set the color to colormap entry 1. ; Note that this has to be less than or equal to !d.table_size, otherwise ; it is set to !d.table_size-1 (see the IDL manulal pages on tv). ; Note, that the background with no xyouts text will get colormap entry 0. xyouts, x, y, text, /normal, color=1, size=size ; Grab the invisible window: grab = tvrd() ; Make colormap which has black as entry 0 and icolor as entry 1: r = bytarr(256) g = bytarr(256) b = bytarr(256) r(1) = icolor(0) g(1) = icolor(1) b(1) = icolor(2) ; Write GIF image giffile = outbasename + '.gif' write_gif, giffile, grab, r, g, b ; Make IRIS image and delete GIF image: if (gif ne 1) then begin spawn, 'which fromgif', result ; Remember: result is a string array if (result(0) eq 'fromgif: Command not found.') then begin print, result end else begin rgbfile = outbasename + '.rgb' spawn, 'fromgif' + ' ' + giffile + ' ' + rgbfile ; Make IRIS file spawn, '/bin/rm' + ' ' + giffile ; Delete GIF file end end end