17 static void xform_cell(
unsigned short*,
unsigned short*,
int,
int,
int,
int);
47 if (
string ==
NULL)
return;
83 int x, y, degrees, scale;
99 int next, next1, bwidth, cwidth;
101 int ynow, xw, cx, xn, bcnt;
102 unsigned short rotbuf[16], *ctab;
103 unsigned short z, z1, imask;
104 unsigned char cbuf, omask;
105 unsigned char mask[22];
108 union {
unsigned short color2;
unsigned char c[2]; }
c;
110 if (scale < 1 || scale > 10)
return;
111 if (text ==
NULL)
return;
113 if (degrees >= 90) degrees /= 90;
120 outpw(0x3ce,
c.color2 & 0xff00);
126 cwidth = fwidth*scale;
129 y -= strlen(text)*fheight*scale;
137 y -= strlen(text)*fheight*scale;
144 cwidth = fwidth*scale;
147 x -= strlen(text)*cwidth;
153 x -= strlen(text)*cwidth;
166 str1 = text + strlen(text);
168 while (str0 != str1) {
169 if (x + cwidth < Xl || x >
Xu) {
170 if (degrees & 4)
break;
177 memset(mask,0xff,bwidth+1);
179 z = (
Xl >> 3) - (x >> 3);
181 mask[z] >>= (
Xl & 7);
183 if (Xu < x + cwidth) {
184 z = (Xu >> 3) - (x >> 3) + 1;
185 memset(mask+z,0,bwidth+1-z);
186 mask[z-1] <<= 8 - (Xu & 7);
190 if ((tx = (*--str1 & 0x7f) -
' ') < 0) tx = 0;
193 if ((tx = (*str0++ & 0x7f) -
' ') < 0) tx = 0;
196 xform_cell(rotbuf,ctab,fwidth,fheight,degrees,fwidth);
197 ctab = rotbuf + fheight - 1;
201 for (i = fheight; i; i--,ctab--) {
202 for (j = scale; j; j--) {
203 if (ynow >=
Yl && ynow <=
Yu) {
208 for (k = fwidth; k; k--) {
209 for (l = scale; l; l--) {
210 if (imask & *ctab) cbuf |= omask;
211 if (!(omask >>= 1)) {
213 cbuf &= mask[bcnt++];
241 for (i = fheight; i; i--, ctab--) {
242 if (ynow >=
Yl && ynow <=
Yu) {
245 *rgen = (*((
char *) &imask + 1) & mask[0]);
249 *rgen = ((char) imask & mask[1]);
255 ((char) (*ctab << (8 - cx)) & mask[2]);
291 int x, y, degrees, scale;
295 int i,
ii, j, k, tx, next;
299 unsigned short rotbuf[16], *ctab, mask;
300 union {
long l;
unsigned short o[2];}
p;
303 union {
unsigned short color2;
unsigned char c[2]; }
c;
310 if (scale < 1 || scale > 10)
return;
311 if (text ==
NULL)
return;
313 if (degrees >= 90) degrees /= 90;
323 y -= strlen(text)*fheight*scale;
331 y -= strlen(text)*fheight*scale;
337 next1 = (
pc.
xsize*fheight + fwidth)*scale;
340 x -= strlen(text)*fwidth*scale;
346 x -= strlen(text)*fwidth*scale;
354 next =
pc.
xsize + fwidth*scale;
356 str1 = text + strlen(text);
357 while (str0 != str1) {
360 if ((tx = (*--str1 & 0x7f) -
' ') < 0) tx = 0;
363 if ((tx = (*str0++ & 0x7f) -
' ') < 0) tx = 0;
366 xform_cell(rotbuf,ctab,fwidth,fheight,degrees,fwidth);
367 ctab = rotbuf + fheight - 1;
370 for (i = fheight; i; i--, ctab--) {
371 for (j = scale; j; j--) {
372 if (ynow >=
Yl && ynow <=
Yu) {
374 for (mask = 0x8000,ii = fwidth;
ii; mask >>= 1,ii--) {
375 for (k = scale; k; k--) {
376 if (xnow >=
Xl && xnow <=
Xu) {
378 if (cbuf !=
p.o[1]) {
417 int x, y, degrees, scale;
421 int i,
ii, j, k, tx, next;
425 unsigned short rotbuf[16], *ctab, mask;
427 union {
unsigned short color2;
unsigned char c[2]; }
c;
435 if (scale < 1 || scale > 10)
return;
436 if (text ==
NULL)
return;
438 if (degrees >= 90) degrees /= 90;
446 y -= strlen(text)*fheight*scale;
454 y -= strlen(text)*fheight*scale;
460 next1 = (
pc.
xsize*fheight + fwidth)*scale;
463 x -= strlen(text)*fwidth*scale;
469 x -= strlen(text)*fwidth*scale;
477 next =
pc.
xsize + fwidth*scale;
479 str1 = text + strlen(text);
480 while (str0 != str1) {
483 if ((tx = (*--str1 & 0x7f) -
' ') < 0) tx = 0;
486 if ((tx = (*str0++ & 0x7f) -
' ') < 0) tx = 0;
489 xform_cell(rotbuf,ctab,fwidth,fheight,degrees,fwidth);
490 ctab = rotbuf + fheight - 1;
493 for (i = fheight; i; i--, ctab--) {
494 for (j = scale; j; j--) {
495 if (ynow >=
Yl && ynow <=
Yu) {
497 for (mask = 0x8000,ii = fwidth;
ii; mask >>= 1,ii--) {
498 for (k = scale; k; k--) {
499 if (xnow >=
Xl && xnow <=
Xu) {
514 rgen += fwidth*scale;
556 if ((mx && rotn == 0) || (!mx && rotn == 2) ||
557 (my && rotn == 1) || (!my && rotn == 3))
561 if ((my && (rotn == 0 || rotn == 1)) ||
562 (!my && (rotn == 2 || rotn == 3)))
564 if ((mx && (rotn == 0 || rotn == 3)) ||
565 (!mx && (rotn == 1 || rotn == 2)))
574 unsigned
short *out,*in;
579 for (i = 0; i < h; i++) {
580 k = ((code & 2) ? h-i-1 : i);
582 for (j = 0,out[i] = 0; j < w; j++) {
583 l = ((code & 1) ? (w-j-1) : j);
584 out[i] |= ((in[j] >> k) & 1) << l;
589 for (j = 0,out[i] = 0; j < w; j++)
590 out[i] |= ((in[k] >> j) & 1) << (w-j-1);
596 for (i = 0,j = 16-shift; i < h; i++)
static void mode1_render_text()
void MFBSetTextClip(int xl, int yl, int xu, int yu)
void MFBTextBB(char *string, int *len, int *hei)
void MFBText(char *s, int x, int y, int r)
void MFBScaledText(char *s, int x, int y, int r, int sc)
static void mode2_render_text()