🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #37747

Drawing to Viewport Widgets

#37747
From: bmcprog
Date: Tue, 06 Mar 1990 18:08
60 lines
2293 bytes

Could anyone spare some insight into viewport widgets (the name of some
example source
code would do I have the release and contrib tapes)? I am trying to use a viewport
widget to display some 8 bit grayscale images.

I create a viewport widget by:

	m_draw  = XtCreateManagedWidget ("Product", viewportWidgetClass, m_main,
					 NULL, ZERO);

with the following resources:

	"*Viewport*borderWidth:		2",
	"*Viewport*allowHoriz:		True",
	"*Viewport*allowVert:		True",
	"*Viewport*forceBars:		True",
	"*Viewport*width:		512",
	"*Viewport*height:		512",
	"*Viewport*useBottom:		True",
	"*Viewport*useRight:		True",

What I wish to do is to have a 1024 x 1024 drawing region, a grayscale colormap and
use XPutImage to do the drawing. So I tried:

	num_args = 0;
	XtSetArg (args[num_args], XtNwidth, 1024);
	num_args++;
	XtSetArg (args[num_args], XtNheight, 1024);
	num_args++;
	m_draw_surface = XtCreateManagedWidget ("output", labelWidgetClass, m_draw,
						 args, num_args);

to set my drawing region and:

	XSetStandardColormap (XtDisplay(m_draw_surface), 
			      DefaultRootWindow (XtDisplay(parent)),
			      cmap, XA_RGB_GRAY_MAP);

to set the colormap.

When I test the code thus far, I do not get the results I expected (ie two
sliders on the right and bottom and a blank screen). Rather I get the
viewport widget
no sliders and a label widget with the label "output" in the upper left (the
text is what I expected, the rest is not). So:

1) What is the best way to do what I want?
2) What's the best way to draw images into a viewport?

Many Thanks,

--Bruce
----------------------------------------------------
Bruce M. Cameron                    bmc@bru.mayo.edu
Medical Sciences 1-14               (507) 284-3288
Mayo Foundation                     WD9CKW
Rochester, MN 55905
----------------------------------------------------
Technical Details
Message-ID: <9003061808.AA00983@mycroft.mayo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!think!snorkelwacker!bloom-beacon!MYCROFT.MAYO.EDU!bmcprog

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!think!snorkelwacker!bloom-beacon!MYCROFT.MAYO.EDU!bmcprog
From: bmcprog@MYCROFT.MAYO.EDU
Newsgroups: comp.windows.x
Subject: Drawing to Viewport Widgets
Message-ID: <9003061808.AA00983@mycroft.mayo.edu>
Date: 6 Mar 90 18:08:16 GMT
Sender: daemon@athena.mit.edu (Mr Background)
Organization: The Internet
Lines: 60