|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 3347 (0xd13)
Types: TextFile
Names: »mf_X10.c«
└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89
└─⟦this⟧ »./tex82/Unsupported/MFpxl/mflib/mf_X10.c«
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12
└─⟦beba6c409⟧ »unix3.0/Unsupported.tar.Z«
└─⟦25c524ae4⟧
└─⟦this⟧ »Unsupported/MFpxl/mflib/mf_X10.c«
#ifdef X10WIN
/*
* mf_X10.c:
* Graphics Window interface to MetaFont for X Windows Version 10.
*
* Written on 28 December 1987 by Hal Peterson
* hrp%hall.cray.com@umn-rei-uc.arpa
*/
#include <X/Xlib.h>
#include <stdio.h>
#include "mftypes.h"
/*
* Boolean return values for Pascal
*/
#define FALSE 0
#define TRUE 1
/*
* Graphics display size, taken from section 11 of Metafont: The Program
*/
#define screen_width 768
#define screen_depth 1024
/*
* Pixel values for foreground and background. This is temporary;
* A proper implementation will deal with colors and get them from
* .Xdefaults.
*/
#define foreground 0
#define background 1
/*
* This is the translation matrix for colors. Zero is background, and
* one is foreground.
*/
static int colors[] = {
background, /* 0 */
foreground /* 1 */
};
/*
* The output window.
*/
static Window window;
/*
* init_screen: boolean; return true if window operations legal
*/
mf_X10_initscreen()
{
if (XOpenDisplay(NULL) == NULL) {
/*
* Could not open the display; the DISPLAY environment
* variable is incorrect or not set.
*/
fprintf (stderr,
"! I thought your were at an X display, but X disagrees.\n");
return (FALSE);
} else if ((window = XCreateWindow (RootWindow,
0, 0,
screen_width, screen_depth,
0, (Pixmap *) 0,
(Pixmap *) 0)) == (Window) 0) {
/*
* Could not open a window. Don't know why.
*/
fprintf (stderr,
"! I tried to open a window on your X display, but could not.\n");
return (FALSE);
} else {
/*
* We have a window. Erase it, then put it on the screen.
*/
XPixSet (window, 0, 0, screen_width, screen_depth, background);
XMapWindow (window);
XFlush();
return (TRUE);
}
}
/*
* updatescreen: transmit changes to the display.
*/
mf_X10_updatescreen()
{
/*
* For the moment, this seems to be sufficient.
*
* A more complete implementation will handle exposure events here.
*/
XFlush();
}
/*
* blankrectangle: reset rectangle bounded by ([left,right],[top,bottom])
* to background color
*/
mf_X10_blankrectangle(left, right, top, bottom)
screencol left, right;
screenrow top, bottom;
{
XPixSet (window,
left, top,
right - left, bottom - top,
background);
}
/*
* 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_X10_paintrow(row, init_color, transition_vector, vector_size)
screenrow row;
pixelcolor init_color;
transspec transition_vector;
screencol vector_size;
{
/*
* This will be an index into a two-entry array of colors,
* to be toggled for each element of the transition vector.
*/
register int color = (init_color == 0) ? 0 : 1;
/*
* Go through the transition_vector, painting a row as instructed.
*/
do {
/*
* Draw a line of the appropriate color.
*/
XLine (window,
transition_vector[0], row,
transition_vector[1] - 1, row,
1, 1,
colors[color],
GXcopy, AllPlanes);
/*
* Move to the next slot in the transition vector
*/
transition_vector++;
/*
* Toggle the color from foreground to background
* or vice versa.
*/
color = 1 - color;
} while (--vector_size);
}
#endif X10WIN