21 PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_mem =
"mem:User-supplied memory device:-1:mem:46:mem\n";
26 void plD_line_mem(
PLStream *,
short,
short,
short,
short );
36 #define MAX( a, b ) ( ( a > b ) ? a : b )
37 #define ABS( a ) ( ( a < 0 ) ? -a : a )
39 #define MAX_INTENSITY 255
43 #ifndef ENABLE_DYNDRIVERS
44 pdt->
pl_MenuStr =
"User-supplied memory device";
73 if ( ( pls->
phyxma == 0 ) || ( pls->
dev == NULL ) )
75 plexit(
"Must call plsmem first to set user plotting area!" );
80 plexit(
"The mem driver does not support alpha values! Use plsmem!" );
92 #define sign( a ) ( ( a < 0 ) ? -1 : ( ( a == 0 ) ? 0 : 1 ) )
95 plD_line_mem(
PLStream *pls,
short x1a,
short y1a,
short x2a,
short y2a )
99 int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a;
100 PLINT x1b, y1b, x2b, y2b;
101 PLFLT length, fx, fy, dx, dy;
102 unsigned char *mem = (
unsigned char *) pls->
dev;
108 y1 = ym - ( y1 - 0 );
109 y2 = ym - ( y2 - 0 );
111 x1b = x1, x2b = x2, y1b = y1, y2b = y2;
112 length = (
PLFLT) sqrt( (
double)
113 ( ( x2b - x1b ) * ( x2b - x1b ) + ( y2b - y1b ) * ( y2b - y1b ) ) );
117 dx = ( x2 - x1 ) / length;
118 dy = ( y2 - y1 ) / length;
122 mem[3 * xm * y1 + 3 * x1 + 0] = pls->
curcolor.
r;
123 mem[3 * xm * y1 + 3 * x1 + 1] = pls->
curcolor.
g;
124 mem[3 * xm * y1 + 3 * x1 + 2] = pls->
curcolor.
b;
126 mem[3 * xm * y2 + 3 * x2 + 0] = pls->
curcolor.
r;
127 mem[3 * xm * y2 + 3 * x2 + 1] = pls->
curcolor.
g;
128 mem[3 * xm * y2 + 3 * x2 + 2] = pls->
curcolor.
b;
130 for ( i = 1; i <= (int) length; i++ )
135 mem[idx + 0] = pls->curcolor.r;
136 mem[idx + 1] = pls->curcolor.g;
137 mem[idx + 2] = pls->curcolor.b;
142 plD_polyline_mem(
PLStream *pls,
short *xa,
short *ya,
PLINT npts )
145 for ( i = 0; i < npts - 1; i++ )
146 plD_line_mem( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] );
void(* plD_line_fp)(struct PLStream_struct *, short, short, short, short)
void plexit(PLCHAR_VECTOR errormsg)
void(* plD_eop_fp)(struct PLStream_struct *)
void(* plD_state_fp)(struct PLStream_struct *, PLINT)
void(* plD_tidy_fp)(struct PLStream_struct *)
void(* plD_polyline_fp)(struct PLStream_struct *, short *, short *, PLINT)
void(* plD_esc_fp)(struct PLStream_struct *, PLINT, void *)
void(* plD_bop_fp)(struct PLStream_struct *)
void plP_setpxl(PLFLT xpmm, PLFLT ypmm)
#define PLDLLIMPEXP_DRIVER
static PLStream * pls[PL_NSTREAMS]
plD_polyline_fp pl_polyline
void(* plD_init_fp)(struct PLStream_struct *)
PLDLLIMPEXP_DRIVER void plD_dispatch_init_mem(PLDispatchTable *pdt)