[comp.sys.sgi] Putting an image onto the IRIS root window

wes@uh.msc.umn.edu (Wes Barris) (11/27/90)

Is there a way to place an image onto the root window of a 4D series
IRIS?  The first step would be to convert the image from whatever
format it is in to the proper format (IRIS rle maybe?).  The next
step would be to load it onto the root.  I have not found any information
about this in the manuals.  Has anyone done this?

      o o o o o o o . . .   ________________________________ _____=======_____
    o      _____            |Wes Barris                    | | wes@msc.edu   |
  .][__n_n_|DD[  ====_____  |Minnesota Supercomputer Center| |(612) 626-1854 |
 >(________|__|_[_________]_|University of Minnesota_______|_|_FAX:_624-6550_|_
 _/oo OOOOO oo`  ooo   ooo  'o^o^o                    o^o^o` 'o^o         o^o`
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Have you locked your file cabinet?

operator@IRIS.KTH.DK (Martin Liversage) (11/27/90)

> Is there a way to place an image onto the root window of a 4D series
> IRIS?

There are (as far as I know) two ways. To get more info on both read
the 4Sight Programmers Guide.

1) Use imakebackground from some process you run in the background.

2) Redefine PaintRoot in your user.ps file.

   /PaintRoot {
      % Your own PostScript code to draw background

      % plain blue background
      0.0 0.3 0.5 rgbcolor setcolor clipcanvaspath fill

      % replace with code to draw image
      % e.g. insert file image.ps gotten from 'tops image.bw image.ps'
      % tops has recently been made available from sgi.com, directory
      % graphics, login ftp (see message <75885@sgi.sgi.com> for more
      % details)
   } def

You probably don't want to do any complicated drawing on the root as
it has to be redrawn every time it gets exposed. Try some of the roots
in the Windows toolchest and see the results.

Martin Liversage <operator@iris.kth.dk>
Royal Dental College Copenhagen
Department of Pediatric Dentistry
Norre Alle 20
DK-2200 Kobenhavn N

howardl@sgi.com (Howard Look) (12/04/90)

In article <3016@uc.msc.umn.edu> wes@msc.edu writes:
>Is there a way to place an image onto the root window of a 4D series
>IRIS?  The first step would be to convert the image from whatever
>format it is in to the proper format (IRIS rle maybe?).  The next
>step would be to load it onto the root.  I have not found any information
>about this in the manuals.  Has anyone done this?

Check out the man page for imakebackground. You could use longimage
from the image library to read a .rgb file, and then lrectwrite to
get it into the window.

Here's a copy of the now infamous night background to give you an
idea of how to use imakebackground.

Enjoy,
Howard.

/***** CUT HERE ******/
#include "gl.h"
#include "device.h"

/*
A way cool background that looks like the twilight sky.
Start it up in user.ps

Howard Look, April 13, 1990
*/

main()
{
	int gid;
	
	imakebackground() ;

	gid = winopen("") ;
	RGBmode();
	gconfig();
	shademodel(GOURAUD);
	
	ortho2(0.0, 1.0, 0.0, 1.0) ;

	qenter(REDRAW,gid);

	while (1)
	{
		short val ;
		long dev = qread(&val) ;
		if (dev == REDRAW) draw_background() ;
	}
}

#define Y1 0.0
#define Y2 .2

draw_background()
{
    int i,j;
	static int orange[] = {255,72,0};
	static int blueish[] = {0,110,189};
	static int black[] = {0,0,0};
	static int red[] = {255,0,0};
	float v1[2],v2[2],v3[2],v4[2];

	v1[0] = v4[0] = 0.0;
	v2[0] = v3[0] = 1.0;

	v1[1] = v2[1] = 0.0;
	v3[1] = v4[1] = Y1;
	bgnpolygon();
		c3i(red);
		v2f(v1);
		v2f(v2);
		c3i(orange);
		v2f(v3);
		v2f(v4);
	endpolygon();

	v1[1] = v2[1] = Y2;
	bgnpolygon();
		c3i(orange);
		v2f(v4);
		v2f(v3);
		c3i(blueish);
		v2f(v2);
		v2f(v1);
	endpolygon();

	v3[1] = v4[1] = 1.0;
	bgnpolygon();
		c3i(blueish);
		v2f(v1);
		v2f(v2);
		c3i(black);
		v2f(v3);
		v2f(v4);
	endpolygon();

	cpack(0xFFFFFF);

    for (j=0; j<10; j++)
    {
        bgnpoint();
        for (i=0; i<256; i++)
        {
			float x[2];
			x[0] = ((float)rand())/32767.0;
			x[1] = ((float)rand())/32767.0;
			v2f(x);
        }
        endpoint();
    }

    for (j =0; j<200; j++)
    {
		float x[2],r;
		x[0] = ((float)rand())/32767.0;
		x[1] = ((float)rand())/32767.0;
		r = ((float)rand())/32767.0/500.0;
		circf(x[0],x[1],r);
    }
}