DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T m

⟦316c38846⟧ TextFile

    Length: 2087 (0x827)
    Types: TextFile
    Names: »mf_xwin.c«

Derivation

└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89
    └─⟦this⟧ »./tex82/Unsupported/FromJapan/mf84.support/mf84/MFlib/mf_xwin.c« 
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12
    └─⟦beba6c409⟧ »unix3.0/Unsupported.tar.Z« 
        └─⟦25c524ae4⟧ 
            └─⟦this⟧ »Unsupported/FromJapan/mf84.support/mf84/MFlib/mf_xwin.c« 

TextFile

#ifndef lint
static	char RCSid[] = "$Header: mf_xwin.c,v 1.1 87/05/18 11:40:15 ikadai Exp $";
#endif

#ifdef	XWIN
#define SCREEN_X	50
#define SCREEN_Y	50
#define SCREEN_ROWS	400
#define SCREEN_COLS	500

/*
 * Graphics Window interface to MetaFont for X windows
 */

#include <stdio.h>
#include <X/Xlib.h>
#include "mftypes.h"

/*
 * global handle on the graphics subwindow (if run inside gfxtool)
 */

static Window	win;


/*
 * init_screen: boolean;  return true if window operations legal
 */

mf_xwin_initscreen()
{
	if(XOpenDisplay(NULL) == NULL) {
		fprintf(stderr, "! Window access requires METAFONT to run under X-Window\n");
		return(0);
	}
	win = XCreateWindow(RootWindow,
			 SCREEN_X, SCREEN_Y, SCREEN_COLS, SCREEN_ROWS,
					 3, BlackPixmap, WhitePixmap);
	if(win == 0) {
		fprintf(stderr, "! cannot create a window\n");
		return(0);
	}
	XMapWindow(win);
	return(1);
}

/*
 * updatescreen; -- just make sure screen is ready to view
 */

mf_xwin_updatescreen()
{
	XFlush();
}

/*
 * blankrectangle: reset rectangle bounded by ([left,right],[top,bottom])
 *			to background color
 */

mf_xwin_blankrectangle(left, right, top, bottom)
	screencol left, right;
	screenrow top, bottom;

/* Original with AllPlanes Added!
{
	XCopyArea(win, left, top, left, top, right-left+1, bottom-top+1,
					 GXclear, AllPlanes);
}
*/

{
	XPixSet(win, left, top, right-left+1, bottom-top+1, WhitePixel);
}

/*
 * paintrow -- paint "row" starting with color "init_color",  up to next
 *		transition specified by "transition_vector", switch colors,
 *		and continue for "vector_size" transitions.
 */

mf_xwin_paintrow(row, init_color, transition_vector, vector_size)
	screenrow	row;
	pixelcolor	init_color;
	transspec	transition_vector;
	screencol	vector_size;
{
	register	col;
	register	color;

	color = (init_color == 0)? WhitePixel : BlackPixel;

	do {
		col = *transition_vector++;
		XLine(win, col, row, (*transition_vector)-1, row, 1, 1,
			color, GXcopy, AllPlanes);
	
		if(color == WhitePixel)
			color = BlackPixel;
		else
			color = WhitePixel;
	} while (--vector_size);
}

#endif	XWIN