[comp.sys.hp] xseethru

dl23+@andrew.cmu.edu (Damon Wayne Lipparelli) (04/15/89)

Hello.  On the hp 835's there is a program called "xseethru" which allows you to
see the full color planes if you are running in the overlay planes.  I'm trying
to write something similar only on a more specific scale.  Does anyone know how
it works?

I've tried various things with varying results.  The program that comes the
closest is this one:

#include <stdio.h>
#include <starbase.c.h>

main(argc,argv)
int argc;
char **argv;
{
  int fd,f2;
  float p_l[2][3],r[3],p1[3],p2[3];
  int c;
  gescape_arg a,b;

  system("xwcreate -geometry =600x600 foo -bw 0");

  if ((fd = gopen("/dev/screen/foo",OUTINDEV,"sox11",0)) == -1)
    {
      fprintf(stderr,"Error:  Couldn't open window.\n");
      exit(-1);
    }

  if ((f2 = gopen("/dev/ocrt0",OUTDEV,"hp98731",0)) == -1)
    {
      fprintf(stderr,"Error:  Couldn't open overlay planes.\n");
      exit(-2);
    }

  inquire_sizes(fd,p_l,r,p1,p2,&c);
  background_color_index(fd,c-1);
  clear_control(fd,CLEAR_DISPLAY_SURFACE);
  clear_view_surface(fd);
  make_picture_current(fd);

  a.i[0] = FALSE;
  gescape(f2,SWITCH_SEMAPHORE,&a,&b);
  a.i[0] = c-1;
  gescape(f2,R_TRANSPARENCY_INDEX,&a,&b);
  a.i[0] = TRUE;
  gescape(f2,SWITCH_SEMAPHORE,&a,&b);

  while (1)
   ;
  gclose(fd);
  system("xwdestroy foo");
}

This opens a window which _does_ show the full color planes, but as soon as the
mouse is moved, or a key is hit, X disables the transparency.  What magic does
xseethru do?

Damon Lipparelli
Graphics Support Staff
Engineering Design Research Center

kam@hpcvlx.HP.COM (Keith Marchington) (04/18/89)

/ hpcvlx:comp.sys.hp / dl23+@andrew.cmu.edu (Damon Wayne Lipparelli) /  2:59 pm  Apr 14, 1989 /

> Hello.  On the hp 835's there is a program called "xseethru" which
> allows you to see the full color planes if you are running in the
> overlay planes.  I'm trying to write something similar only on a more
> specific scale.  Does anyone know how it works?
> 
    <Program deleted>
> 
> Damon Lipparelli
> Graphics Support Staff
> Engineering Design Research Center
> ----------

I guess the big question here is which version of X are you running?  If it
is Version 10, then the way xseethru works is magic (if I remember correctly.) 
If it is Version 11, then you should be able to actually create windows with
a background color of "Transparent" that will allow you to see thru to the 
image planes.  In fact, you can actually set the root window to transparent
on X 11 with the command

	xsetroot -solid transparent

assuming that you have a color cell in the colormap available.  In fact 
that is the mode that I prefer to work in (in that configuration.)  This
makes it seem as though the windows are simply "floating" over whatever image
you have in the image planes.

Keith Marchington
Hewlett-Packard
Corvallis, OR  USA

steve@hpcvlx.HP.COM (Steve Hiebert) (04/18/89)

What OS level are you at?  Mixing X and Starbase calls to the same
device isn't supported before 3.1.  (The overlay and image planes are
considered two devices unless one is running in Combined Mode in 3.1).
If you're running 3.1, you shouldn't be making Starbase calls directly
to the overlay planes hardware when X is running there.  You should be
going to a window.  When X wakes up it restores the transparency
registers to the values it thinks they should have; modifying the
hardware directly doesn't give X a chance to know that something has
changed.

The SRX and TSRX don't really have a transparent color - we "borrowed"
a color (0,0,1) that would normally be a blue so close to black as to
be indistinguishable and therefore probably useless.  Whenever the
server gets a pixel value of (0,0,1) it sets the the overlays to black
and the image planes to dominant thereby making the overlays
transparent (they actually blend).

How about setting "-bg transparent" in your call to xwcreate()?  I
often do an "xsetroot -solid transparent".  It makes the windows in
the overlays appear to float over the image planes.  It seems more
intuitive to me than to have to punch a hole in the overlay planes to
get to the image planes.

Steve Hiebert
Hewlett-Packard
Corvallis Workstation Operation

stroyan@hpfcdc.HP.COM (Mike Stroyan) (04/18/89)

> Hello.  On the hp 835's there is a program called "xseethru" which
> allows you to see the full color planes if you are running in the
> overlay planes.  I'm trying to write something similar only on a more
> specific scale.  Does anyone know how it works?

There is a magic color in the rgb database called "transparent".  The
rgb data would correspond to a very dark blue, but it is actually
rendered as transparency to the full color planes.  For instance, "xterm
-bg transparent" will produce a terminal window with a transparent
background.

Mike Stroyan, stroyan@hpfcla.hp.com