[comp.windows.x] XView and image display

alan@judy.Jpl.Nasa.Gov (Alan S. Mazer) (02/07/90)

Has anyone out there successfully displayed an image in OpenWindows without
using pw_ calls?  I can't find any examples that do this and everything I've
tried simply core dumps.  If you have, would you PLEASE send (or post) sample
code?  Thanks.

-- Alan				# "But seriously, what could go wrong?"
   ..!cit-vax!elroy!alan
   alan@elroy.jpl.nasa.gov

argv%turnpike@Sun.COM (Dan Heller) (02/07/90)

In article <1990Feb6.202148.14508@elroy.jpl.nasa.gov> alan@judy.Jpl.Nasa.Gov (Alan S. Mazer) writes:
> Has anyone out there successfully displayed an image in OpenWindows without
> using pw_ calls?  I can't find any examples that do this and everything I've
> tried simply core dumps.  If you have, would you PLEASE send (or post) sample
> code?  Thanks.

The sample code that comes with XView (on expo) has a complete directory
full of examples that do this and many other things that people are asking
here.  These are the same examples used in the XView Programmer's Manual
(Volume 7 of O'Reilly && Associates Series on X books).
dan
-----------------------------------------------------------
		    O'Reilly && Associates
		argv@sun.com / argv@ora.com
	   632 Petaluma Ave, Sebastopol, CA 95472 
     800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104

hvr@kimba.Sun.COM (Heather Rose) (02/09/90)

In article <1990Feb6.202148.14508@elroy.jpl.nasa.gov> alan@judy.Jpl.Nasa.Gov (Alan S. Mazer) writes:
>Has anyone out there successfully displayed an image in OpenWindows without
>using pw_ calls?  I can't find any examples that do this and everything I've
>tried simply core dumps.  If you have, would you PLEASE send (or post) sample
>code?  Thanks.

Just use XPutImage(display, xid, gc, image, src_x, src_y, dst_x, dst_y,
	width, height);

i.e.

    canvas = xv_create(frame, CANVAS,
        CANVAS_REPAINT_PROC,    canvas_repaint,
        CANVAS_X_PAINT_WINDOW,  TRUE,
...

canvas_repaint(canvas, pw, display, xid, xrects)
Canvas          canvas;
Xv_Window       pw;
Display         *display;
Window          xid;
Xv_xrectlist    *xrects;
{

...

    XPutImage(display, xid, gc, image,
        0, 0, x, y, w, h);
...

Regards,

Heather

rick@hanauma.stanford.edu (Richard Ottolini) (02/09/90)

In article <131499@sun.Eng.Sun.COM> hvr@sun.UUCP (Heather Rose) writes:
>In article <1990Feb6.202148.14508@elroy.jpl.nasa.gov> alan@judy.Jpl.Nasa.Gov (Alan S. Mazer) writes:
>>Has anyone out there successfully displayed an image in OpenWindows without
>>using pw_ calls?  I can't find any examples that do this and everything I've
>>tried simply core dumps.  If you have, would you PLEASE send (or post) sample
>>code?  Thanks.
>
>Just use XPutImage(display, xid, gc, image, src_x, src_y, dst_x, dst_y,
>	width, height);

Incomplete answer.  Colors should be set up with X calls too in place
of pixwin calls.
In XView the color-map-segment code finds a contigious block of free
color space and puts the color table there.  The pw_rop command calls
XPutImage, but adds the color table offset to each pixel in the XImage
data before XPutImage and subtracts it after.