123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- #include "sys-defines.h"
- #include "extern.h"
- #define FIVEBITS 0x1F
- #define TWOBITS 0x03
- void
- _pl_t_tek_vector (R___(Plotter *_plotter) int xx, int yy)
- {
- unsigned char xx_high, yy_high;
- unsigned char xx_low, yy_low;
- unsigned char xx_topsig, yy_topsig;
- unsigned char egm;
- unsigned char byte_buf[5];
- int num_bytes = 0;
-
- #ifdef NO_WRAP
- if (xx < 0)
- xx = 0;
- if (yy < 0)
- yy = 0;
- #endif
- xx_high = (xx>>7) & FIVEBITS;
- yy_high = (yy>>7) & FIVEBITS;
-
- xx_low = (xx>>2) & FIVEBITS;
- yy_low = (yy>>2) & FIVEBITS;
-
- xx_topsig = xx & TWOBITS;
- yy_topsig = yy & TWOBITS;
- egm = (yy_topsig<<2) + xx_topsig;
-
- byte_buf[num_bytes++] = yy_high | 0x20;
- #ifdef CAN_OMIT_EGM
- if (egm)
- #endif
- byte_buf[num_bytes++] = egm | 0x60;
- byte_buf[num_bytes++] = yy_low | 0x60;
- byte_buf[num_bytes++] = xx_high | 0x20;
- byte_buf[num_bytes++] = xx_low | 0x40;
-
- _write_bytes (_plotter->data, num_bytes, byte_buf);
- return;
- }
- void
- _pl_t_tek_vector_compressed (R___(Plotter *_plotter) int xx, int yy, int oldxx, int oldyy, bool force)
- {
- unsigned char xx_high, yy_high, oldxx_high, oldyy_high;
- unsigned char xx_low, yy_low, oldyy_low;
- unsigned char xx_top, yy_top;
- unsigned char egm;
- unsigned char byte_buf[5];
- int num_bytes = 0;
-
- #ifdef NO_WRAP
- if (xx < 0)
- xx = 0;
- if (yy < 0)
- yy = 0;
- #endif
-
- if (!force && (xx == oldxx) && (yy == oldyy))
- return;
- xx_high = (xx>>7) & FIVEBITS;
- yy_high = (yy>>7) & FIVEBITS;
- oldxx_high = (oldxx>>7) & FIVEBITS;
- oldyy_high = (oldyy>>7) & FIVEBITS;
-
- xx_low = (xx>>2) & FIVEBITS;
- yy_low = (yy>>2) & FIVEBITS;
- oldyy_low = (oldyy>>2) & FIVEBITS;
-
- xx_top = xx & TWOBITS;
- yy_top = yy & TWOBITS;
- egm = (yy_top<<2) + xx_top;
-
- if (yy_high != oldyy_high)
- byte_buf[num_bytes++] = yy_high | 0x20;
- #ifdef CAN_OMIT_EGM
- if (egm)
- #endif
- byte_buf[num_bytes++] = egm | 0x60;
- #ifdef CAN_OMIT_LO_Y
- if ((yy_low != oldyy_low) || (xx_high != oldxx_high) || egm)
- #endif
- byte_buf[num_bytes++] = yy_low | 0x60;
- if (xx_high != oldxx_high)
- byte_buf[num_bytes++] = xx_high | 0x20;
- byte_buf[num_bytes++] = xx_low | 0x40;
-
- _write_bytes (_plotter->data, num_bytes, byte_buf);
- return;
- }
|