sunview programming question (border on frame)

Bruce Allen ballen at convex.csd.uwm.edu
Wed Jun 5 04:40:00 AEST 1991


I am writing some short sunview code segments to display a rasterfile in a
640x480 window.  I create a base frame then a canvas inside it.  Then I draw
into the canvas. 

My problem: the frame has a border which is 5 pixels wide on each side.  I
would like to narrow this border to either 0 or 1 pixel.  How can I do this?

The two relevant functions:

void openwindow()
{
	frame=window_create(NULL,FRAME,
		WIN_ERROR_MSG,"Can't create window",
		FRAME_SHOW_LABEL,FALSE,
		WIN_WIDTH,650,	/* NOTE: allows extra 5 pixel border */
		WIN_HEIGHT,490, /* NOTE: allows extra 5 pixel border */
		0);

	canvas=window_create(frame,CANVAS,
		CANVAS_WIDTH,640,
		CANVAS_HEIGHT,480,
		0);
	cursor=window_get(canvas,WIN_CURSOR);
	cursor_set(cursor,CURSOR_OP,PIX_DST,0);
	window_set(canvas,WIN_CURSOR,cursor,0);
	pw=(Pixwin *)canvas_pixwin(canvas);
}

displayit(fpointer)
FILE *fpointer;
{
	Pixrect *pr;
	colormap_t cm;

	pr=pr_load(fpointer,&cm);
	if (pr==NULL) {
		perror("Unable to read in rasterfile!");
		abort();
	}
	pw_setcmsname(pw,"grayscales");
	pw_batch_on(pw); 
	pw_putcolormap(pw,0,cm.length,cm.map[0],cm.map[1],cm.map[2]);
	pw_write(pw,0,0,640,480,PIX_SRC,pr,0,0);
	pw_batch_off(pw); 
	window_set(frame,WIN_SHOW,TRUE,0); 
	notify_dispatch();
	pr_destroy(pr);
	sleep(1);
}




More information about the Comp.sys.sun mailing list