[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1018.0. "Fill routine problem" by PEEVAX::GIFFORD (Fetch the Holy Hand Grenade) Mon Jun 26 1989 19:06

Stop me if you have heard this one before...

I am a bit of a neophite with both 'c' and DECwindows, nevertheless I have 
managed to create an application which is intended to be used at the main
entrance of Australian DECUS 1989 in August.

I am using 9 display servers in a 3x3 matrix controlled from another VAX to
give the effect of a matrix monitor (a big one).

On the whole everthing is going great! (Lots of assistance has been given tho).

Now I have struck a problem using the FillArc and the FillPolygon routines.

The effect is as if there is clip mask on part of my screen, and whenever I
issue a fill command, part of the display gets chopped!

I have taken my original program, and created a smaller version which is
in the first reply to this note, which demonstrates this. on the middle/middle
screen of the big display.

I am currently running vms 5.1 + decwindows 5.1

The attached program does not demonstrate the fillarc problem (which was the
effect of a chord missing on a complete circle, but I suspect the same root causes
caused this.

The actual program is supposed to draw two polygons 1 which is filled with white
and is a more complex one, and one filled with grey which is effectivly a 
trapezium (sic).

The effect is noticed on the right hand side of the image, where it is as if a
black box was drawn chopping the image.

I am (obviously) prepared to submit a QAR on this, however I would at least 
appreciate it if anyone could have a look and advise on what is probably a 
programming error rather than a fault with DECWindows.

Regards

Stan.

T.RTitleUserPersonal
Name
DateLines
1018.1PEEVAX::GIFFORDFetch the Holy Hand GrenadeMon Jun 26 1989 20:46371
/*
Copyright etc.
*/
#include <stdio.h>
#include <ctype.h>
#include <decw$include/dwtappl.h>
#include <decw$include/xlib.h>
#include <decw$include/xatom.h>
#include <decw$include/xutil.h>
#include math
#define helvetica_24 "-adobe-helvetica-bold-r-normal--24*"

Font   font_hel_14,font_hel_18,font_hel_24;


static int mm_darkslategrey;
static int mm_lightred;
static int mm_red,mm_orange,mm_yellow,mm_green,mm_blue,mm_indigo,mm_violet,mm_black,mm_white;


static int tlx,tly,tmx,tmy,trx,try;
static int mlx,mly,mmx,mmy,mrx,mry;
static int blx,bly,bmx,bmy,brx,bry;
 
static int wk1,wk2;
static int winw,winh;

	    
static void frame1();
static void demomain();
static void clearall();
static void s_warn();
static void s_error();
static void apply_proc();

static	char *ml_text,*mm_text,*mr_text;
static char *ml_screen,*mm_screen,*mr_screen;


Display *d_mm;

XPoint *decus_top;
XPoint *decus_bot;

XRectangle *clip_rect;
XPoint *nzs,*nzn,*tas,*aus,*png,*frame,*frameo;

Window tl,tm,tr,ml,mm,mr,bl,bm,br;
Window p_tl,p_tm,p_tr,p_ml,p_mm,p_mr,p_bl,p_bm,p_br;

XEvent	xev;

Colormap ml_map,mm_map,mr_map;

XColor   color;
XColor   dum_sd;


extern GC XCreateGC();

XGCValues xgcv;

GC gc_ml,gc_mm,gc_mr;


XSetWindowAttributes xswa_mm;


unsigned int main(argc,argv)
	unsigned int argc;
	char *argv[];

{

	apply_proc();
  }

/*
 *               That's the main code over and done with
 * 		 Now the various routines.....
 */


static void s_warn(problem_string)
	char *problem_string;
{
	printf("%s\n", problem_string);
	return;
}

static void s_error(problem_string)
	char *problem_string;

{
	printf("%s\n", problem_string);
	exit(0);
}


static void apply_proc()
{
	int curx;
	int prevx;
	int curd;
	int cury;
	int prevy;
	int curdy;
	curdy=1;
	cury=1;
	prevy=0;
	curd = 1;
	curx=0;
	prevx=0;
    mm_screen = strcat("0","::0" );
/*
 *  Now open all screens and realize them.....
 */
 
	printf("%s%s\n","Opening display MIDDLE MIDDLE ",mm_screen);
	if (!(d_mm = XOpenDisplay(mm_screen)))
		{
		s_warn("Can't open MIDDLE MIDDLE display");} 
	XSynchronize(d_mm,1);

	winh=1200;
	winw=1920;

	decus_top = malloc(sizeof(XPoint) * 9);
	decus_bot = malloc(sizeof(XPoint) * 9);

	nzs	  = malloc(sizeof(XPoint) * 12);
	nzn	  = malloc(sizeof(XPoint) * 10);
	tas	  = malloc(sizeof(XPoint) * 8);
	png	  = malloc(sizeof(XPoint) * 16);
	aus	  = malloc(sizeof(XPoint) * 32);
	frame	  = malloc(sizeof(XPoint) * 5);
	frameo	  = malloc(sizeof(XPoint) * 11);
	wk1=winh / 3;
	wk2=winw / 3;
/*
 * Plug in co-ordinates for our map
 */
	frame[0].x=wk2 + (47 * 3);
	frame[1].x=wk2 + (137 * 3);
	frame[2].x=wk2 + (150 * 3);
	frame[3].x=wk2 + (37 * 3);
	frame[4].x=frame[0].x;

	frame[0].y=wk1 + (97 * 3);
	frame[1].y=frame[0].y;
	frame[2].y=wk1 + (30 * 3);
	frame[3].y=frame[2].y;
	frame[4].y=frame[0].y;

	frameo[0].x=wk2 + (44 * 3);
	frameo[1].x=wk2 + (140 * 3);
	frameo[2].x=wk2 + (152 * 3);
	frameo[3].x=wk2 + (144 * 3);
	frameo[4].x=wk2 + (143 * 3);
	frameo[5].x=wk2 + (140 * 3);
	frameo[6].x=wk2 + (77 * 3);
	frameo[7].x=wk2 + (77 * 3);
	frameo[8].x=wk2 + (75 * 3);
	frameo[9].x=wk2 + (32 * 3);
	frameo[10].x=frameo[0].x;
	frameo[0].y=wk1 + (101 * 3);
	frameo[1].y=frameo[0].y;
	frameo[2].y=wk1 + (28 * 3);
	frameo[3].y=wk1 + (11 * 3);
	frameo[4].y=frame[3].y;
	frameo[5].y=wk1 + (26 * 3);
	frameo[6].y=frameo[5].y;
	frameo[7].y=wk1 + (18 * 3);
	frameo[8].y=wk1 + (16 * 3);
	frameo[9].y=wk1 + (28 * 3);
	frameo[10].y=frameo[0].y;
	
/*
 * first Tasmania
 */

	tas[0].x=wk2 + (97 * 3);
        tas[0].y=wk1 + (90 * 3);

	tas[7].x=tas[0].x;
	tas[7].y=tas[0].y;

	tas[1].x=wk2 + (99 * 3);
	tas[1].y=wk1 + (91 * 3);

	tas[2].x=wk2 + (103 * 3);
	tas[2].y=wk1 + (91 * 3);

	tas[3].x=wk2 + (101 * 3);
	tas[3].y=wk1 + (94 * 3);

	tas[4].x=wk2 + (100 * 3);
	tas[4].y=wk1 + (95 * 3);
	
	tas[5].x=wk2 + (98 * 3);
	tas[5].y=wk1 + (96 * 3);

	tas[6].x=wk2 + (96 * 3);
	tas[6].y=wk1 + (91 * 3);

	tlx=0;
	tly=0;
	tmx=winw/3;
	tmy=0;
	trx=(winw/3)*2;
	try=0;

	mlx=0;
	mly=winh/3;
	mmx=winw/3;
	mmy=winh/3;
	mrx=(winw/3) *2;
	mry=winh/3;

	blx=0;
	bly=(winh/3)*2;
	bmx=winw/3;
	bmy=(winh/3)*2;
	brx=(winw/3)*2;
	bry=(winh/3)*2;



	xswa_mm.event_mask=0;
        xswa_mm.background_pixel = BlackPixel(d_mm,0);
	p_mm=XCreateWindow(d_mm,RootWindow(d_mm,0),0,0,winw/3,winh/3,0,
	     DefaultDepth(d_mm,0),InputOutput,DefaultVisual(d_mm,0),
		CWEventMask | CWBackPixel,&xswa_mm);
	XChangeProperty(d_mm,p_mm,XA_WM_NAME,XA_STRING,8,
		PropModeReplace,"Middle Middle",13);
	mm=XCreateSimpleWindow(d_mm,p_mm,
		  -winw/3,-winh/3,
		   winw,winh,0,0,BlackPixel(d_mm,0));
	XmapWindow(d_mm,mm);
	XmapWindow(d_mm,p_mm);


	gc_mm = XCreateGC(d_mm,mm,0,NULL);

	XSetFillStyle(d_mm,gc_mm,FillSolid);
	XSetFillRule(d_mm,gc_mm,WindingRule);
	
	clip_rect = malloc(sizeof(XRectangle) * 1);
	clip_rect[0].x=0;
	clip_rect[0].y=0;
	clip_rect[0].width=winw;
	clip_rect[0].height=winh;
	XSetClipRectangles(d_mm,gc_mm,0,0,&clip_rect[0],1,Unsorted);

	XSetArcMode(d_mm,gc_mm,ArcPieSlice);


 	mm_map=XDefaultColormap(d_mm,DefaultScreen(d_mm));
	if (!mm_map) s_error("Can't get default MM color map");

/*
        Define the colors we are going to be using
 */

	XAllocNamedColor(d_mm,mm_map,
		     "DECWBlue",&color,&dum_sd);
        mm_blue=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "Red",&color,&dum_sd);
        mm_red=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "White",&color,&dum_sd);
        mm_white=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "Black",&color,&dum_sd);
        mm_black=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "Orange",&color,&dum_sd);
        mm_orange=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "Yellow",&color,&dum_sd);
        mm_yellow=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "Green",&color,&dum_sd);
        mm_green=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "SlateBlue",&color,&dum_sd);
        mm_indigo=color.pixel;
	XAllocNamedColor(d_mm,mm_map,
		     "Violet",&color,&dum_sd);
        mm_violet=color.pixel;

	XAllocNamedColor(d_mm,mm_map,"DarkSlateGrey",&color,&dum_sd);
	mm_darkslategrey=color.pixel;
	XAllocNamedColor(d_mm,mm_map,"Red",&color,&dum_sd);
	mm_lightred=color.pixel;

	demomain();
}

static void demomain()
{
	for (;;)
	{
	  clearall();
 	  frame1();
	}
}

static void frame1()
{
/*
 * Create digital logo 
 */
 	int logow,logoh,logox,logoy,boxw,barw,s,t,cx,cy,cd,tx,ty,fullc;
/*
 * Now draw the 1989 decus logo in middle middle screen
 */
	font_hel_24 = XLoadFont(d_mm,helvetica_24);
	XSetFont(d_mm,gc_mm,font_hel_24);

	logow=winw / 3;
	logoh=winh / 3;
	
	XSetForeground(d_mm,gc_mm,mm_lightred);
	XFillRectangle(d_mm,mm,gc_mm,0,0,winw,winh);
	XSetForeground(d_mm,gc_mm,mm_darkslategrey);

/*
 * First draw text in bottom of screen
 */	
	logox = (winw / 3) + 150;
	logoy = (winh / 3) + 335;
        XDrawString(d_mm,mm,gc_mm,logox,logoy,"Windows to the Future",21);
/*
 *   Now draw beginning and end box
 */	
	logox = (winw / 3) + 132;
        logoy = (winh / 3) + 324;
	XFillRectangle(d_mm,mm,gc_mm,logox,logoy,9,9);
	logox = (winw / 3) + 424;
	XFillRectangle(d_mm,mm,gc_mm,logox,logoy,9,9);
/*
 * Now draw Australia (gulp)
 */


	XSetForeground(d_mm,gc_mm,mm_white);
	XFillPolygon(d_mm,mm,gc_mm,&frameo[0],10,Complex,CoordModeOrigin);
	XSetForeground(d_mm,gc_mm,mm_black);
	XDrawLines(d_mm,mm,gc_mm,&frameo[0],10,CoordModeOrigin);

	XSetForeground(d_mm,gc_mm,mm_darkslategrey);
	XFillPolygon(d_mm,mm,gc_mm,&frame[0],5,Complex,CoordModeOrigin);
	XSetForeground(d_mm,gc_mm,mm_black);
	XDrawLines(d_mm,mm,gc_mm,&frame[0],5,CoordModeOrigin);

	XSetForeground(d_mm,gc_mm,mm_white);
	XFillPolygon(d_mm,mm,gc_mm,&tas[0],8,Complex,CoordModeOrigin);
	XSetForeground(d_mm,gc_mm,mm_black);
	XDrawLines(d_mm,mm,gc_mm,&tas[0],8,CoordModeOrigin);

 
	sleep(5);
}

static void clearall()
{
	XClearArea(d_mm,mm,0,0,winw,winh,0);
}

1018.2PEEVAX::GIFFORDFetch the Holy Hand GrenadeMon Jun 26 1989 22:5913
More information....

As I may mentioned in the base note I intend using PC's for the actual
display, but I am testing the majority of the time on my PVAX.

I have found that the actual 'clip' occurs when using fillarc or fillpolygon
at the boundary of the actual PVAX screen - i.e in a hor direction at 1024.

The problem does not occur when I use a PC as the display server!

I suspect there is an inconsistancy in the way the fill routines work between
the two different servers (VAX and PC)!