16 #ifdef __GO32__ // dos386/djgpp
24 "ljii:LaserJet II Bitmap File (150 dpi):0:ljii:33:ljii\n";
31 void plD_line_ljii(
PLStream *,
short,
short,
short,
short );
32 void plD_polyline_ljii(
PLStream *,
short *,
short *,
PLINT );
46 #define OF pls->OutFile
47 #define DPI 150 // Resolution Dots per Inch
50 #define XDOTS 1104L // # dots across
51 #define YDOTS 1410L // # dots down
52 #define BPROW XDOTS / 8L // # bytes across
53 #define NBYTES BPROW * YDOTS // total number of bytes
61 {
'\200',
'\100',
'\040',
'\020',
'\010',
'\004',
'\002',
'\001' };
69 static char _HUGE *bitmap;
73 #ifndef ENABLE_DYNDRIVERS
74 pdt->
pl_MenuStr =
"LaserJet II Bitmap File (150 dpi)";
146 if ( ( bitmap = (
char _HUGE *) halloc( (
long) NBYTES,
sizeof (
char ) ) ) == NULL )
147 plexit(
"Out of memory in call to calloc" );
149 if ( ( bitmap = (
void *) calloc( NBYTES,
sizeof (
char ) ) ) == NULL )
150 plexit(
"Out of memory in call to calloc" );
155 fprintf(
OF,
"%cE", ESC );
165 plD_line_ljii(
PLStream *pls,
short x1a,
short y1a,
short x2a,
short y2a )
169 int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a;
170 PLINT x1b, y1b, x2b, y2b;
175 y1 = dev->
ymax - ( y1 - dev->
ymin );
176 y2 = dev->
ymax - ( y2 - dev->
ymin );
183 x1b = x1, x2b = x2, y1b = y1, y2b = y2;
184 length = (
PLFLT) sqrt( (
double)
185 ( ( x2b - x1b ) * ( x2b - x1b ) + ( y2b - y1b ) * ( y2b - y1b ) ) );
189 dx = ( x2 - x1 ) / length;
190 dy = ( y2 - y1 ) / length;
197 for ( i = 1; i <= (int) length; i++ )
208 plD_polyline_ljii(
PLStream *pls,
short *xa,
short *ya,
PLINT npts )
212 for ( i = 0; i < npts - 1; i++ )
213 plD_line_ljii( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] );
229 fprintf(
OF,
"%c*p%dX", ESC, CURX );
230 fprintf(
OF,
"%c*p%dY", ESC, CURY );
234 fprintf(
OF,
"%c*t%dR", ESC,
DPI );
235 fprintf(
OF,
"%c*r1A", ESC );
239 for ( j = 0; j < YDOTS; j++ )
241 fprintf(
OF,
"%c*b%ldW", ESC, BPROW );
242 for ( i = 0; i < BPROW; i++ )
243 putc( *( bitmap + i + j * BPROW ),
OF );
249 fprintf(
OF,
"%c*rB", ESC );
250 fprintf(
OF,
"%c", FF );
254 memset( bitmap,
'\0', NBYTES );
284 fprintf(
OF,
"%cE", ESC );
286 free( (
void *) bitmap );
321 index = x / 8 + y * BPROW;
322 *( bitmap + index ) = *( bitmap + index ) | mask[x % 8];