Jspice3
mfbbasic.c File Reference
#include "spice.h"
#include "mfb.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for mfbbasic.c:

Go to the source code of this file.

Macros

#define RadToDeg   57.29577951
 
#define MFBFORMAT   MFBCurrent->strings
 
#define WNDW   MFBCurrent->currentWindow
 
#define VWPRT   MFBCurrent->currentViewport
 

Functions

void MFBNaiveBoxFill ()
 
void MFBSetGhost ()
 
int MFBInfo (int Info)
 
void MFBConvertToHLS (int r, int g, int b)
 
void SetCurrentMFB (MFB *mfb)
 
void MFBZeroCounters ()
 
void MFBCounters (int *nChars, int *nBoxes, int *meanBoxArea, int *nLines, int *meanLineLength, int *nPixels)
 
 MFBSetLineStyle (int styleId)
 
 MFBSetFillPattern (int styleId)
 
int MFBSetChannelMask (int channelMask)
 
int MFBSetReadMask (int readMask)
 
int MFBSetColor (int colorId)
 
int MFBSetTextMode (Bool destructiveBool)
 
int MFBSetALUMode (int mode)
 
int MFBSetCursorColor (int colorId1, int colorId2)
 
int MFBSetBlinker (int colorId, int r, int g, int b, int onFlag)
 
int MFBSetRubberBanding (Bool RubberBandingBool, int X, int Y)
 
int MFBDefineColor (int colorId, int r, int g, int b)
 
int MFBDefineFillPattern (int styleId, int *BitArray)
 
int MFBDefineLineStyle (int styleId, int BitArray)
 
void MFBMoveTo (int X1, int Y1)
 
void MFBDrawPath (MFBPATH *path)
 
void MFBDrawLineTo (int X1, int Y1)
 
void MFBLine (int X1, int Y1, int X2, int Y2)
 
void MFBBox (int l, int b, int r, int t)
 
void MFBArc (int x, int y, int r, int astart, int astop, int s)
 
void MFBCircle (int x, int y, int r, int s)
 
void MFBFlash (int x, int y, int r, int s)
 
void MFBPolygon (MFBPOLYGON *p)
 
void MFBText (char *text, int x, int y, int phi)
 
void MFBPixel (int x, int y)
 
void MFBFlood ()
 
MFBPATHMFBArcPath (int x, int y, int r, int astart, int astop, int s)
 
MFBPOLYGONMFBEllipse (int x, int y, int rx, int ry, int s)
 
int MFBScaleX (int X)
 
int MFBScaleY (int Y)
 
int MFBDescaleX (int X)
 
int MFBDescaleY (int Y)
 
void MFBSetViewport (int left, int bottom, int right, int top)
 
void MFBSetWindow (int left, int bottom, int right, int top)
 
void MFBNaiveBoxFill (left, bottom, right, top)
 

Variables

MFBMFBCurrent
 
int LastX
 
int LastY
 

Macro Definition Documentation

#define MFBFORMAT   MFBCurrent->strings

Definition at line 28 of file mfbbasic.c.

#define RadToDeg   57.29577951

Definition at line 27 of file mfbbasic.c.

#define VWPRT   MFBCurrent->currentViewport

Definition at line 1094 of file mfbbasic.c.

#define WNDW   MFBCurrent->currentWindow

Definition at line 1093 of file mfbbasic.c.

Function Documentation

void MFBArc ( int  x,
int  y,
int  r,
int  astart,
int  astop,
int  s 
)

Definition at line 780 of file mfbbasic.c.

792 {
793  int i,j,xx,yy;
794  double d;
795 
796  d = astart / RadToDeg;
797  xx = x + (int)(r * cos(d));
798  yy = y + (int)(r * sin(d));
799  /* Must use MFBLine to force a DSL sequence if style Id is solid */
800  MFBLine(xx,yy,xx,yy);
801  while(astart >= astop)
802  astop += 360;
803  if(s>2 && s<181)
804  j = MFBmax(1,(astop - astart)/s);
805  else
806  j = MFBmax(1,(astop - astart)/18);
807  for(i = astart + j; i <= astop; i += j){
808  d = i / RadToDeg;
809  MFBCurrent->X = x + (int)(r * cos(d));
810  MFBCurrent->Y = y + (int)(r * sin(d));
811  MFBGenCode(MFBFORMAT.drawLineToSequence);
812  }
813  d = astop / RadToDeg;
814  MFBCurrent->X = x + (int)(r * cos(d));
815  MFBCurrent->Y = y + (int)(r * sin(d));
816  MFBGenCode(MFBFORMAT.drawLineToSequence);
817 }
Definition: cddefs.h:119
#define MFBFORMAT
Definition: mfbbasic.c:28
void MFBLine(int X1, int Y1, int X2, int Y2)
Definition: mfbbasic.c:725
int Y
Definition: mfb.h:222
Definition: cddefs.h:237
MFB * MFBCurrent
Definition: mfbbasic.c:31
double cos()
double sin()
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
#define RadToDeg
Definition: mfbbasic.c:27
int X
Definition: mfb.h:222
#define MFBmax(a, b)
Definition: mfb.h:33
Definition: cddefs.h:162
MFBPATH* MFBArcPath ( int  x,
int  y,
int  r,
int  astart,
int  astop,
int  s 
)

Definition at line 1002 of file mfbbasic.c.

1013 {
1014  static MFBPATH pth;
1015  static int xy[400];
1016  int *ip,i,j;
1017  double d;
1018 
1019  pth.xy = ip = xy;
1020  while(astart >= astop)
1021  astop += 360;
1022  if(s<2 || s>180)
1023  s = 20;
1024  pth.nvertices = 2;
1025  j = MFBmax(1,(astop - astart)/s);
1026  d = astart / RadToDeg;
1027  *ip++ = x + (int)(r * cos(d));
1028  *ip++ = y + (int)(r * sin(d));
1029  for(i = astart + j; i <= astop; i += j){
1030  d = i / RadToDeg;
1031  *ip++ = x + (int)(r * cos(d));
1032  *ip++ = y + (int)(r * sin(d));
1033  ++pth.nvertices;
1034  }
1035  d = astop / RadToDeg;
1036  *ip++ = x + (int)(r * cos(d));
1037  *ip = y + (int)(r * sin(d));
1038  return(&pth);
1039 }
Definition: cddefs.h:119
int nvertices
Definition: mfb.h:105
Definition: cddefs.h:237
double cos()
Definition: mfb.h:104
double sin()
#define RadToDeg
Definition: mfbbasic.c:27
#define MFBmax(a, b)
Definition: mfb.h:33
Definition: cddefs.h:162
int * xy
Definition: mfb.h:106
void MFBBox ( int  l,
int  b,
int  r,
int  t 
)

Definition at line 751 of file mfbbasic.c.

759 {
760 #ifdef DEBUG
761  MFBCurrent->nBoxes += 1;
762  MFBCurrent->sumBoxArea += (r-l)*(t-b);
763 #endif
764  MFBCurrent->X = l; MFBCurrent->Y = b; MFBCurrent->Z = r; MFBCurrent->T = t;
765  if(MFBCurrent->fillPattern == 0
766  && MFBFORMAT.drawSolidBoxSequence != NULL
767  && *MFBFORMAT.drawSolidBoxSequence != 0) {
768  MFBGenCode(MFBFORMAT.drawSolidBoxSequence);
769  }
770  else if (MFBFORMAT.drawBoxSequence != NULL
771  && *MFBFORMAT.drawBoxSequence != 0) {
772  MFBGenCode(MFBFORMAT.drawBoxSequence);
773  }
774  else
775  MFBNaiveBoxFill(l,b,r,t);
776 }
int T
Definition: mfb.h:222
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
Definition: cddefs.h:312
int nBoxes
Definition: mfb.h:282
int Z
Definition: mfb.h:222
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
int fillPattern
Definition: mfb.h:268
void MFBNaiveBoxFill()
int sumBoxArea
Definition: mfb.h:282
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
Definition: cddefs.h:162
Definition: cddefs.h:192
void MFBCircle ( int  x,
int  y,
int  r,
int  s 
)

Definition at line 821 of file mfbbasic.c.

831 {
832  int i,j=5;
833  double d=0;
834 
835  if(MFBFORMAT.drawCircleSequence == NULL
836  || *MFBFORMAT.drawCircleSequence == 0) {
837  MFBCurrent->X = x + r;
838  MFBCurrent->Y = y;
839  if(s>2 && s<181)
840  j = MFBmax(1,360/s);
841  for(i = j; i <= 360; i += j){
842  d = i / RadToDeg;
843  MFBCurrent->Z = x + (int)(r * cos(d));
844  MFBCurrent->T = y + (int)(r * sin(d));
845  MFBGenCode(MFBFORMAT.drawLineSequence);
846  MFBCurrent->X = MFBCurrent->Z;
847  MFBCurrent->Y = MFBCurrent->T;
848  }
849  } else {
850  MFBCurrent->X = x;
851  MFBCurrent->Y = y;
852  MFBCurrent->Z = r;
853  MFBGenCode(MFBFORMAT.drawCircleSequence);
854  }
855 }
Definition: cddefs.h:119
int T
Definition: mfb.h:222
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
int Z
Definition: mfb.h:222
Definition: cddefs.h:237
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
double cos()
double sin()
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
#define RadToDeg
Definition: mfbbasic.c:27
int X
Definition: mfb.h:222
#define MFBmax(a, b)
Definition: mfb.h:33
Definition: cddefs.h:162
void MFBConvertToHLS ( int  r,
int  g,
int  b 
)

Definition at line 158 of file mfbbasic.c.

165 {
166  double rrr,ggg,bbb,rr,gg,bb,sum,dif,mx,mn,lit,intensity;
167  intensity = (double)MFBCurrent->maxIntensity;
168  /* RGB is normalized to 1000 */
169  rr = ((double) r)/1000.0;
170  gg = ((double) g)/1000.0;
171  bb = ((double) b)/1000.0;
172  mx = rr;
173  if(mx < gg) mx = gg;
174  if(mx < bb) mx = bb;
175  mn = rr;
176  if(mn > gg) mn = gg;
177  if(mn > bb) mn = bb;
178  sum = mx + mn; dif = mx - mn;
179  if(dif != 0.0){
180  rrr = (mx - rr)/dif; ggg = (mx - gg)/dif; bbb = (mx - bb)/dif;
181  }
182  /* lightness calculation */
183  lit = sum/2.0;
184  /* saturation calculation */
185  if(mx == mn) MFBCurrent->T = 0;
186  else if(lit <= .5) MFBCurrent->T = (int)(intensity * dif/sum);
187  else MFBCurrent->T = (int)((intensity * dif)/(2.0 - sum));
188  /* hue calculation */
189  if(MFBCurrent->T == 0) MFBCurrent->Y = 0;
190  else if(rr == mx) MFBCurrent->Y = (int)(60.0 * (2.0 + bbb - ggg));
191  else if(gg == mx) MFBCurrent->Y = (int)(60.0 * (4.0 + rrr - bbb));
192  else MFBCurrent->Y = (int)(60.0 * (6.0 + ggg - rrr));
193  MFBCurrent->Z = (int)(intensity * lit);
194 }
int maxIntensity
Definition: mfb.h:234
int T
Definition: mfb.h:222
int Y
Definition: mfb.h:222
int Z
Definition: mfb.h:222
MFB * MFBCurrent
Definition: mfbbasic.c:31
Definition: cddefs.h:162
Definition: cddefs.h:227
void MFBCounters ( int *  nChars,
int*  nBoxes,
int*  meanBoxArea,
int*  nLines,
int*  meanLineLength,
int*  nPixels 
)

Definition at line 224 of file mfbbasic.c.

226 {
227 #ifdef DEBUG
228  /*
229  * routine for measuring approximate pixel bandwidth
230  */
231  *nChars = MFBCurrent->nChars;
232  *nBoxes = MFBCurrent->nBoxes;
233  *nLines = MFBCurrent->nLines;
234  *meanLineLength = 0;
235  *meanBoxArea = 0;
236  if(MFBCurrent->nBoxes != 0)
237  *meanBoxArea = MFBCurrent->sumBoxArea/MFBCurrent->nBoxes;
238  if(MFBCurrent->nLines != 0)
239  *meanLineLength = MFBCurrent->sumLineLength/MFBCurrent->nLines;
240  *nPixels =
244 #else
245  *nChars = *nBoxes = *nLines = *meanLineLength = *meanBoxArea = 0;
246 #endif
247 }
int nLines
Definition: mfb.h:283
int fontWidth
Definition: mfb.h:251
int sumLineLength
Definition: mfb.h:283
int nBoxes
Definition: mfb.h:282
MFB * MFBCurrent
Definition: mfbbasic.c:31
int fontHeight
Definition: mfb.h:250
int nChars
Definition: mfb.h:281
int sumBoxArea
Definition: mfb.h:282
int MFBDefineColor ( int  colorId,
int  r,
int  g,
int  b 
)

Definition at line 549 of file mfbbasic.c.

557 {
558 
559  /* Are there user defineable colors? */
560  if(!MFBCurrent->vltBool)
561  return(MFBNODFCO);
563  /* HLS return in MFBCurrent->Y, MFBCurrent->Z, MFBCurrent->T */
564  MFBConvertToHLS(r,g,b);
565  }
566  else{
567  /* Normalize to 1000 */
568  MFBCurrent->Y = r * MFBCurrent->maxIntensity / 1000;
569  MFBCurrent->Z = g * MFBCurrent->maxIntensity / 1000;
570  MFBCurrent->T = b * MFBCurrent->maxIntensity / 1000;
571  }
572  MFBCurrent->X = MFBmax(0,MFBmin(MFBCurrent->maxColors,colorId));
573  MFBGenCode(MFBFORMAT.vltEntry);
574  return(MFBOK);
575 }
void MFBConvertToHLS(int r, int g, int b)
Definition: mfbbasic.c:158
#define MFBOK
Definition: mfb.h:491
int maxIntensity
Definition: mfb.h:234
int T
Definition: mfb.h:222
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
int maxColors
Definition: mfb.h:227
int Z
Definition: mfb.h:222
Bool vltUseHLSBool
Definition: mfb.h:310
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define MFBmin(a, b)
Definition: mfb.h:34
#define MFBNODFCO
Definition: mfb.h:505
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
#define MFBmax(a, b)
Definition: mfb.h:33
Definition: cddefs.h:162
Definition: cddefs.h:227
Bool vltBool
Definition: mfb.h:309
int MFBDefineFillPattern ( int  styleId,
int *  BitArray 
)

Definition at line 579 of file mfbbasic.c.

588 {
589  int i,*j,Count;
590 
591  /* save current stipple pattern */
592  for(i=0; i<8; ++i)
593  MFBCurrent->stipplePattern[i] = BitArray[i];
594 
595  /*
596  * Are there defineable fill patterns for this frame buffer?
597  */
599  return(MFBNODFFP);
600 
601  MFBCurrent->X = styleId;
603  Count = MFBCurrent->fillDefineHeight;
604  else
605  Count = MFBCurrent->fillDefineWidth;
606  MFBGenCode(MFBFORMAT.fillDefineStart);
607  for(i=0; i<Count; ++i){
608  if( (int)((i/8) * 8) == i) j = BitArray;
609  MFBCurrent->Y = *j++;
610  MFBGenCode(MFBFORMAT.fillDefineFormat);
611  }
612  MFBGenCode(MFBFORMAT.fillDefineEnd);
613  /* return with the new fill pattern as the current one */
614  return( MFBSetFillPattern(styleId) );
615 }
int fillDefineWidth
Definition: mfb.h:261
#define MFBFORMAT
Definition: mfbbasic.c:28
int fillDefineHeight
Definition: mfb.h:260
int Y
Definition: mfb.h:222
int stipplePattern[8]
Definition: mfb.h:274
MFB * MFBCurrent
Definition: mfbbasic.c:31
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
MFBSetFillPattern(int styleId)
Definition: mfbbasic.c:288
int X
Definition: mfb.h:222
#define MFBNODFFP
Definition: mfb.h:504
Bool fillDefineRowMajorBool
Definition: mfb.h:346
Bool fillPtrnDefineBool
Definition: mfb.h:345
int MFBDefineLineStyle ( int  styleId,
int  BitArray 
)

Definition at line 619 of file mfbbasic.c.

622 {
623  int l;
624 
625  /*
626  * Are there defineable line styles for this frame buffer?
627  */
629  return(MFBNODFLP);
630 
631  MFBCurrent->X = styleId;
632  MFBGenCode(MFBFORMAT.lineDefineStart);
633  MFBCurrent->Y = BitArray;
634  for(l = 0; l < MFBCurrent->lineDefineLength; ++l)
635  MFBGenCode(MFBFORMAT.lineDefineFormat);
636  MFBGenCode(MFBFORMAT.lineDefineEnd);
637  /* return with the new line style as the current one */
638  return( MFBSetLineStyle(styleId) );
639 }
#define MFBNODFLP
Definition: mfb.h:503
int lineDefineLength
Definition: mfb.h:246
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
Definition: cddefs.h:312
Bool linePatternDefineBool
Definition: mfb.h:325
MFB * MFBCurrent
Definition: mfbbasic.c:31
MFBSetLineStyle(int styleId)
Definition: mfbbasic.c:259
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int MFBDescaleX ( int  X)

Definition at line 1121 of file mfbbasic.c.

1123 {
1124  int XX;
1125 
1126  XX = ((X-VWPRT.left)*WNDW.length)/VWPRT.length+WNDW.left;
1127  return(XX);
1128 }
long X
Definition: actions.c:450
#define WNDW
Definition: mfbbasic.c:1093
#define VWPRT
Definition: mfbbasic.c:1094
int MFBDescaleY ( int  Y)

Definition at line 1131 of file mfbbasic.c.

1133 {
1134  int YY;
1135 
1136  YY = ((Y-VWPRT.bottom)*WNDW.width)/VWPRT.width+WNDW.bottom;
1137  return(YY);
1138 }
#define WNDW
Definition: mfbbasic.c:1093
#define VWPRT
Definition: mfbbasic.c:1094
long Y
Definition: actions.c:450
void MFBDrawLineTo ( int  X1,
int  Y1 
)

Definition at line 696 of file mfbbasic.c.

703 {
706  if(MFBFORMAT.drawLineToSequence == NULL
707  || *MFBFORMAT.drawLineToSequence == 0) {
708  MFBLine(LastX,LastY,X1,Y1);
709  /* the assignment of lastX/Y is redundant for a Tek terminal */
710  LastX = X1; LastY = Y1;
711  }
712  else{
713  MFBCurrent->X = X1; MFBCurrent->Y = Y1;
714  if(MFBCurrent->lineStyle == 0
715  && MFBFORMAT.drawSolidLineToSequence != NULL
716  && *MFBFORMAT.drawSolidLineToSequence != 0)
717  MFBGenCode(MFBFORMAT.drawSolidLineToSequence);
718  else
719  MFBGenCode(MFBFORMAT.drawLineToSequence);
720  }
721 }
int lineStyle
Definition: mfb.h:269
#define MFBFORMAT
Definition: mfbbasic.c:28
void MFBLine(int X1, int Y1, int X2, int Y2)
Definition: mfbbasic.c:725
int Y
Definition: mfb.h:222
int LastY
Definition: mfbbasic.c:652
MFB * MFBCurrent
Definition: mfbbasic.c:31
MFBSetLineStyle(int styleId)
Definition: mfbbasic.c:259
#define NULL
Definition: spdefs.h:121
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
Bool reissueLineStyleBool
Definition: mfb.h:326
int LastX
Definition: mfbbasic.c:652
void MFBDrawPath ( MFBPATH path)

Definition at line 669 of file mfbbasic.c.

678 {
679  int n,x,y;
682  if(path->nvertices < 2)
683  return;
684  n = 2;
685  MFBLine(path->xy[0],path->xy[1],path->xy[2],path->xy[3]);
686  while(n < path->nvertices){
687  x = path->xy[(n << 1)];
688  y = path->xy[(n << 1) + 1];
689  MFBDrawLineTo(x,y);
690  n++;
691  }
692 }
int lineStyle
Definition: mfb.h:269
int nvertices
Definition: mfb.h:105
void MFBLine(int X1, int Y1, int X2, int Y2)
Definition: mfbbasic.c:725
MFB * MFBCurrent
Definition: mfbbasic.c:31
MFBSetLineStyle(int styleId)
Definition: mfbbasic.c:259
Bool reissueLineStyleBool
Definition: mfb.h:326
void MFBDrawLineTo(int X1, int Y1)
Definition: mfbbasic.c:696
int * xy
Definition: mfb.h:106
MFBPOLYGON* MFBEllipse ( int  x,
int  y,
int  rx,
int  ry,
int  s 
)

Definition at line 1043 of file mfbbasic.c.

1053 {
1054  static MFBPOLYGON poly;
1055  static int xy[400];
1056  int i=0;
1057  int j;
1058  int *ip;
1059  double d=0;
1060 
1061  poly.xy = ip = xy;
1062  *ip++ = x + rx;
1063  *ip++ = y;
1064  if(s>2 && s<181)
1065  j = 360/s;
1066  else {
1067  j = 18;
1068  s = 20;
1069  }
1070  poly.nvertices = s + 1;
1071  while(--s) {
1072  i += j;
1073  d = i / RadToDeg;
1074  *ip++ = x + (int)(rx * cos(d));
1075  *ip++ = y + (int)(ry * sin(d));
1076  }
1077  *ip++ = x + rx;
1078  *ip++ = y;
1079  return(&poly);
1080 }
Definition: cddefs.h:119
int nvertices
Definition: mfb.h:105
Definition: cddefs.h:237
double cos()
Definition: mfb.h:104
double sin()
#define RadToDeg
Definition: mfbbasic.c:27
int * xy
Definition: mfb.h:106
void MFBFlash ( int  x,
int  y,
int  r,
int  s 
)

Definition at line 859 of file mfbbasic.c.

866 {
867  int i=0,j;
868  double d=0;
869 
870  MFBCurrent->X = x + r;
871  MFBCurrent->Y = y;
872  if(s>2 && s<181)
873  j = 360/s;
874  else {
875  j = 5;
876  s = 72;
877  }
878  MFBCurrent->Z = s;
879  MFBGenCode(MFBFORMAT.beginPlygnSequence);
880  for(i = j; i < 360; i += j){
881  d = i / RadToDeg;
882  MFBCurrent->X = x + (int)(r * cos(d));
883  MFBCurrent->Y = y + (int)(r * sin(d));
884  MFBGenCode(MFBFORMAT.sendPlygnVertex);
885  }
886  MFBCurrent->X = x + r;
887  MFBCurrent->Y = y;
888  MFBGenCode(MFBFORMAT.endPlygnSequence);
889 }
Definition: cddefs.h:119
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
int Z
Definition: mfb.h:222
Definition: cddefs.h:237
MFB * MFBCurrent
Definition: mfbbasic.c:31
double cos()
double sin()
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
#define RadToDeg
Definition: mfbbasic.c:27
int X
Definition: mfb.h:222
Definition: cddefs.h:162
void MFBFlood ( )

Definition at line 985 of file mfbbasic.c.

990 {
992  MFBGenCode(MFBFORMAT.screenFlood);
993 
994  /*
995  * MFBFlood may destroy last x/y,so be safe about it.
996  */
997  MFBCurrent->lastX = MFBCurrent->lastY = -1;
998 }
#define MFBFORMAT
Definition: mfbbasic.c:28
int fgColorId
Definition: mfb.h:267
int lastX
Definition: mfb.h:221
MFB * MFBCurrent
Definition: mfbbasic.c:31
int lastY
Definition: mfb.h:221
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int MFBInfo ( int  Info)

Definition at line 44 of file mfbbasic.c.

46 {
47  /*
48  * Notes:
49  * MFBInfo is the only routine for acquiring device
50  * specific information. The valid arguments are to
51  * MFBInfo are defined in mfb.h. If an invalid argument
52  * is used, MFBInfo returns -1.
53  */
54  switch(Info){
55  case MAXX:
56  return(MFBCurrent->maxX);
57  case MAXY:
58  return(MFBCurrent->maxY);
59  case MAXCOLORS:
60  return(MFBCurrent->maxColors);
61  case MAXINTENSITY:
62  return(MFBCurrent->maxIntensity);
63  case MAXFILLPATTERNS:
64  return(MFBCurrent->maxFillPatterns);
65  case MAXLINESTYLES:
66  return(MFBCurrent->maxLineStyles);
67  case MAXBLINKERS:
68  return(MFBCurrent->maxBlinkers);
69  case POINTINGDEVICE:
70  return((int)MFBCurrent->PointingDeviceBool);
71  case POINTINGBUTTONS:
72  return((int)MFBCurrent->buttonsBool);
73  case NUMBUTTONS:
74  return(MFBCurrent->numberOfButtons);
75  case BUTTON1:
76  return(MFBCurrent->buttonMask[0]);
77  case BUTTON2:
78  return(MFBCurrent->buttonMask[1]);
79  case BUTTON3:
80  return(MFBCurrent->buttonMask[2]);
81  case BUTTON4:
82  return(MFBCurrent->buttonMask[3]);
83  case BUTTON5:
84  return(MFBCurrent->buttonMask[4]);
85  case BUTTON6:
86  return(MFBCurrent->buttonMask[5]);
87  case BUTTON7:
88  return(MFBCurrent->buttonMask[6]);
89  case BUTTON8:
90  return(MFBCurrent->buttonMask[7]);
91  case BUTTON9:
92  return(MFBCurrent->buttonMask[8]);
93  case BUTTON10:
94  return(MFBCurrent->buttonMask[9]);
95  case BUTTON11:
96  return(MFBCurrent->buttonMask[10]);
97  case BUTTON12:
98  return(MFBCurrent->buttonMask[11]);
99  case TEXTPOSITIONALBE:
100  return((int)MFBCurrent->textPositionableBool);
101  case TEXTROTATABLE:
102  return((int)MFBCurrent->textRotateBool);
103  case FONTHEIGHT:
104  return(MFBCurrent->fontHeight);
105  case FONTWIDTH:
106  return(MFBCurrent->fontWidth);
107  case FONTXOFFSET:
108  return(MFBCurrent->fontXOffset);
109  case FONTYOFFSET:
110  return(MFBCurrent->fontYOffset);
111  case DESTRUCTIVETEXT:
112  return((int)MFBCurrent->replaceTextBool);
113  case OVERSTRIKETEXT:
114  return((int)MFBCurrent->overstrikeTextBool);
115  case VLT:
116  return((int)MFBCurrent->vltBool);
117  case BLINKERS:
118  return((int)MFBCurrent->blinkersBool);
119  case FILLEDPOLYGONS:
120  return((int)MFBCurrent->filledPlygnBool);
121  case DEFFILLPATTERNS:
122  return((int)MFBCurrent->fillPtrnDefineBool);
123  case DEFREADMASK:
124  return((int)MFBCurrent->readMaskBool);
125  case DEFCHANNELMASK:
126  return((int)MFBCurrent->channelMaskBool);
127  case DEFLINEPATTERN:
128  return((int)MFBCurrent->linePatternDefineBool);
129  case CURFGCOLOR:
130  return(MFBCurrent->fgColorId);
131  case CURFILLPATTERN:
132  return(MFBCurrent->fillPattern);
133  case CURLINESTYLE:
134  return(MFBCurrent->lineStyle);
135  case CURCHANNELMASK:
136  return(MFBCurrent->channelMask);
137  case CURREADMASK:
138  return(MFBCurrent->readMask);
139  case NUMBITPLANES:
140  return(MFBCurrent->lengthOfVLT);
141  case RASTERCOPY:
142  return((int)MFBCurrent->rastCopyBool);
143  case OFFSCREENX:
144  return(MFBCurrent->minOffScreenX);
145  case OFFSCREENY:
146  return(MFBCurrent->minOffScreenY);
147  case OFFSCREENDX:
148  return(MFBCurrent->offScreenDX);
149  case OFFSCREENDY:
150  return(MFBCurrent->offScreenDY);
151  default:
152  return(-1);
153  }
154 }
int maxFillPatterns
Definition: mfb.h:262
#define DEFREADMASK
Definition: mfb.h:563
#define BUTTON11
Definition: mfb.h:541
Bool textRotateBool
Definition: mfb.h:333
int lineStyle
Definition: mfb.h:269
int offScreenDX
Definition: mfb.h:230
#define BUTTON6
Definition: mfb.h:536
#define MAXLINESTYLES
Definition: mfb.h:526
#define BUTTON12
Definition: mfb.h:542
#define DEFCHANNELMASK
Definition: mfb.h:555
#define CURCHANNELMASK
Definition: mfb.h:560
int maxLineStyles
Definition: mfb.h:247
#define MAXCOLORS
Definition: mfb.h:523
Bool readMaskBool
Definition: mfb.h:314
#define MAXY
Definition: mfb.h:522
#define FONTWIDTH
Definition: mfb.h:546
#define BUTTON5
Definition: mfb.h:535
int readMask
Definition: mfb.h:271
int numberOfButtons
Definition: mfb.h:239
int maxIntensity
Definition: mfb.h:234
#define BUTTON3
Definition: mfb.h:533
#define BUTTON1
Definition: mfb.h:531
#define BUTTON8
Definition: mfb.h:538
int fgColorId
Definition: mfb.h:267
int fontWidth
Definition: mfb.h:251
int maxColors
Definition: mfb.h:227
Bool buttonsBool
Definition: mfb.h:318
int minOffScreenX
Definition: mfb.h:228
#define BUTTON9
Definition: mfb.h:539
#define TEXTPOSITIONALBE
Definition: mfb.h:543
#define CURFILLPATTERN
Definition: mfb.h:558
#define FONTYOFFSET
Definition: mfb.h:548
Bool channelMaskBool
Definition: mfb.h:313
Bool linePatternDefineBool
Definition: mfb.h:325
int fontXOffset
Definition: mfb.h:252
#define POINTINGBUTTONS
Definition: mfb.h:529
#define FILLEDPOLYGONS
Definition: mfb.h:553
#define DEFLINEPATTERN
Definition: mfb.h:556
Bool textPositionableBool
Definition: mfb.h:332
#define CURLINESTYLE
Definition: mfb.h:559
MFB * MFBCurrent
Definition: mfbbasic.c:31
int maxX
Definition: mfb.h:225
int fontYOffset
Definition: mfb.h:253
#define OVERSTRIKETEXT
Definition: mfb.h:550
int fillPattern
Definition: mfb.h:268
Bool filledPlygnBool
Definition: mfb.h:329
int fontHeight
Definition: mfb.h:250
#define MAXFILLPATTERNS
Definition: mfb.h:525
int channelMask
Definition: mfb.h:270
#define BLINKERS
Definition: mfb.h:552
#define FONTXOFFSET
Definition: mfb.h:547
int buttonMask[12]
Definition: mfb.h:238
int maxY
Definition: mfb.h:226
#define VLT
Definition: mfb.h:551
int minOffScreenY
Definition: mfb.h:229
#define RASTERCOPY
Definition: mfb.h:564
#define BUTTON10
Definition: mfb.h:540
#define NUMBITPLANES
Definition: mfb.h:562
#define POINTINGDEVICE
Definition: mfb.h:528
#define BUTTON4
Definition: mfb.h:534
#define NUMBUTTONS
Definition: mfb.h:530
#define BUTTON2
Definition: mfb.h:532
#define MAXX
Definition: mfb.h:521
#define CURREADMASK
Definition: mfb.h:561
#define DESTRUCTIVETEXT
Definition: mfb.h:549
#define TEXTROTATABLE
Definition: mfb.h:544
#define FONTHEIGHT
Definition: mfb.h:545
int lengthOfVLT
Definition: mfb.h:235
int maxBlinkers
Definition: mfb.h:257
#define OFFSCREENX
Definition: mfb.h:565
Bool replaceTextBool
Definition: mfb.h:334
#define OFFSCREENY
Definition: mfb.h:566
Bool blinkersBool
Definition: mfb.h:338
Bool rastCopyBool
Definition: mfb.h:341
#define DEFFILLPATTERNS
Definition: mfb.h:554
#define MAXBLINKERS
Definition: mfb.h:527
Bool vltBool
Definition: mfb.h:309
#define MAXINTENSITY
Definition: mfb.h:524
#define OFFSCREENDY
Definition: mfb.h:568
#define BUTTON7
Definition: mfb.h:537
int offScreenDY
Definition: mfb.h:231
#define CURFGCOLOR
Definition: mfb.h:557
Bool PointingDeviceBool
Definition: mfb.h:317
Bool fillPtrnDefineBool
Definition: mfb.h:345
Bool overstrikeTextBool
Definition: mfb.h:335
#define OFFSCREENDX
Definition: mfb.h:567
void MFBLine ( int  X1,
int  Y1,
int  X2,
int  Y2 
)

Definition at line 725 of file mfbbasic.c.

732 {
733 #ifdef DEBUG
734  MFBCurrent->nLines += 1;
735  MFBCurrent->sumLineLength += MFBmax(abs(X1-X2),abs(Y1-Y2));
736 #endif
739  MFBCurrent->X = X1; MFBCurrent->Y = Y1;
740  MFBCurrent->Z = X2; MFBCurrent->T = Y2;
741  if(MFBCurrent->lineStyle == 0 && MFBFORMAT.drawSolidLineSequence != NULL
742  && *MFBFORMAT.drawSolidLineSequence != 0)
743  MFBGenCode(MFBFORMAT.drawSolidLineSequence);
744  else
745  MFBGenCode(MFBFORMAT.drawLineSequence);
746  LastX = X2; LastY = Y2;
747 }
int lineStyle
Definition: mfb.h:269
int nLines
Definition: mfb.h:283
int T
Definition: mfb.h:222
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
int LastY
Definition: mfbbasic.c:652
int sumLineLength
Definition: mfb.h:283
int Z
Definition: mfb.h:222
MFB * MFBCurrent
Definition: mfbbasic.c:31
MFBSetLineStyle(int styleId)
Definition: mfbbasic.c:259
#define NULL
Definition: spdefs.h:121
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
#define MFBmax(a, b)
Definition: mfb.h:33
Bool reissueLineStyleBool
Definition: mfb.h:326
int LastX
Definition: mfbbasic.c:652
void MFBMoveTo ( int  X1,
int  Y1 
)

Definition at line 655 of file mfbbasic.c.

661 {
662  /* the assignment of lastX/Y is redundant for a Tek terminal */
663  LastX = MFBCurrent->X = X1; LastY = MFBCurrent->Y = Y1;
664  MFBGenCode(MFBFORMAT.movePenSequence);
665 }
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
int LastY
Definition: mfbbasic.c:652
MFB * MFBCurrent
Definition: mfbbasic.c:31
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int LastX
Definition: mfbbasic.c:652
void MFBNaiveBoxFill ( )
void MFBNaiveBoxFill ( left  ,
bottom  ,
right  ,
top   
)

Definition at line 1169 of file mfbbasic.c.

1170 {
1171  int step;
1172  int incr;
1173  int incr2;
1174  int ll, bb, rr, tt;
1175 
1176  if (top < bottom)
1177  MFBSwapInt (top, bottom);
1178  if (right < left)
1179  MFBSwapInt (left, right);
1180  incr = MFBmax (MFBmax (MFBCurrent->maxX, MFBCurrent->maxY) / 400, 1);
1181  step = incr * 5;
1182  incr2 = incr + (incr >> 1);
1183  ll = left;
1184  bb = bottom;
1185  rr = right;
1186  tt = top;
1187  switch (MFBCurrent->fillPattern) {
1188 
1189  case 0:
1190  /*
1191  * solid
1192  */
1193  if ((right - left) > (top - bottom)) {
1194  for (bb = bottom; bb <= top; bb += incr)
1195  MFBLine (ll, bb, rr, bb);
1196  }
1197  else {
1198  for (ll = left; ll <= right; ll += incr)
1199  MFBLine (ll, bb, ll, tt);
1200  }
1201  break;
1202 
1203  case 1:
1204  /*
1205  * horizontal striped
1206  */
1207  for (bb = bottom; bb < top; bb += step)
1208  MFBLine (ll, bb, rr, bb);
1209  break;
1210 
1211  case 2:
1212  /*
1213  * vertical striped
1214  */
1215  for (ll = left; ll < right; ll += step)
1216  MFBLine (ll, bb, ll, tt);
1217  break;
1218 
1219  case 3:
1220  /*
1221  * diagonal lines
1222  */
1223  ll += step;
1224  bb += step;
1225  while (ll < right && bb < top) {
1226  MFBLine (left, bb, ll, bottom);
1227  ll += step;
1228  bb += step;
1229  }
1230  if (ll >= right) {
1231  while (bb < top) {
1232  MFB_Y_Intercept (left, bb, ll, bottom, right, &tt);
1233  MFBLine (left, bb, right, tt);
1234  bb += step;
1235  ll += step;
1236  }
1237  }
1238  else {
1239  while (ll < right) {
1240  MFB_X_Intercept (left, bb, ll, bottom, top, &rr);
1241  MFBLine (rr, top, ll, bottom);
1242  bb += step;
1243  ll += step;
1244  }
1245  }
1246  while (rr <= right && tt <= top) {
1247  MFB_X_Intercept (left, bb, ll, bottom, top, &rr);
1248  MFB_Y_Intercept (left, bb, ll, bottom, right, &tt);
1249  if (rr > right || tt > top)
1250  break;
1251  MFBLine (rr, top, right, tt);
1252  bb += step;
1253  ll += step;
1254  }
1255  break;
1256 
1257  case 4:
1258  /*
1259  * diagonal lines
1260  */
1261  rr -= step;
1262  bb += step;
1263  while (rr > left && bb < top) {
1264  MFBLine (rr, bottom, right, bb);
1265  rr -= step;
1266  bb += step;
1267  }
1268  if (rr <= left) {
1269  while (bb < top) {
1270  MFB_Y_Intercept (rr, bottom, right, bb, left, &tt);
1271  MFBLine (left, tt, right, bb);
1272  bb += step;
1273  rr -= step;
1274  }
1275  }
1276  else {
1277  while (rr > left) {
1278  MFB_X_Intercept (rr, bottom, right, bb, top, &ll);
1279  MFBLine (rr, bottom, ll, top);
1280  bb += step;
1281  rr -= step;
1282  }
1283  }
1284  while (ll >= left && tt <= top) {
1285  MFB_X_Intercept (rr, bottom, right, bb, top, &ll);
1286  MFB_Y_Intercept (rr, bottom, right, bb, left, &tt);
1287  if (ll < left || tt > top)
1288  break;
1289  MFBLine (left, tt, ll, top);
1290  bb += step;
1291  rr -= step;
1292  }
1293  break;
1294 
1295  case 5:
1296  /*
1297  * plus signs
1298  */
1299  for (bb = bottom; bb < top; bb += (step + step)) {
1300  for (ll = left; ll < right; ll += step) {
1301  MFBLine (ll - incr2, bb, ll + incr2, bb);
1302  MFBLine (ll, bb - incr2, ll, bb + incr2);
1303  }
1304  }
1305  break;
1306 
1307  case 6:
1308  /*
1309  * x's
1310  */
1311  for (bb = bottom; bb < top; bb += (step + step)) {
1312  for (ll = left; ll < right; ll += step) {
1313  MFBLine (ll - incr2, bb - incr2, ll + incr2, bb + incr2);
1314  MFBLine (ll - incr2, bb + incr2, ll + incr2, bb - incr2);
1315  }
1316  }
1317  break;
1318 
1319  default:
1320  case 7:
1321  /*
1322  * outline
1323  */
1324  MFBLine (left, bottom, left, top);
1325  MFBLine (left, top, right, top);
1326  MFBLine (right, top, right, bottom);
1327  MFBLine (right, bottom, left, bottom);
1328  break;
1329 
1330  }
1331 }
Definition: xforms.c:16
void MFBLine(int X1, int Y1, int X2, int Y2)
Definition: mfbbasic.c:725
void MFB_X_Intercept(long x1, long y1, long x2, long y2, long e, long *xi)
Definition: mfblclip.c:50
MFB * MFBCurrent
Definition: mfbbasic.c:31
int maxX
Definition: mfb.h:225
int fillPattern
Definition: mfb.h:268
int maxY
Definition: mfb.h:226
void MFB_Y_Intercept(long x1, long y1, long x2, long y2, long e, long *yi)
Definition: mfblclip.c:32
#define MFBmax(a, b)
Definition: mfb.h:33
#define MFBSwapInt(f1, f2)
Definition: mfb.h:35
void MFBPixel ( int  x,
int  y 
)

Definition at line 972 of file mfbbasic.c.

978 {
979  MFBCurrent->X = x; MFBCurrent->Y = y;
980  MFBGenCode(MFBFORMAT.writePixel);
981 }
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
MFB * MFBCurrent
Definition: mfbbasic.c:31
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
void MFBPolygon ( MFBPOLYGON p)

Definition at line 893 of file mfbbasic.c.

899 {
900  int *xy0,*xy1,n;
901 
902  xy0 = xy1 = p->xy;
903  MFBCurrent->Z = n = p->nvertices;
904  if(n <= 0) return;
905  MFBCurrent->X = *xy1++;
906  MFBCurrent->Y = *xy1++;
907  if(MFBCurrent->fillPattern == 0 &&
908  MFBFORMAT.beginSolidPlygnSequence != NULL &&
909  *MFBFORMAT.beginSolidPlygnSequence != 0)
910  MFBGenCode(MFBFORMAT.beginSolidPlygnSequence);
911  else
912  MFBGenCode(MFBFORMAT.beginPlygnSequence);
913  n--;
914  while(n--) {
915  MFBCurrent->X = *xy1++;
916  MFBCurrent->Y = *xy1++;
917  MFBGenCode(MFBFORMAT.sendPlygnVertex);
918  }
919  MFBCurrent->X = *xy0;
920  MFBCurrent->Y = *(xy0+1);
921  MFBGenCode(MFBFORMAT.endPlygnSequence);
922 }
#define MFBFORMAT
Definition: mfbbasic.c:28
int nvertices
Definition: mfb.h:105
int Y
Definition: mfb.h:222
int Z
Definition: mfb.h:222
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
int fillPattern
Definition: mfb.h:268
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int * xy
Definition: mfb.h:106
int MFBScaleX ( int  X)

Definition at line 1097 of file mfbbasic.c.

1099 {
1100  int XX;
1101 
1102  XX = (int)(((double)(X-WNDW.left)*VWPRT.length)/WNDW.length) + VWPRT.left;
1103  if(XX < VWPRT.left) XX = VWPRT.left;
1104  else if(XX > VWPRT.right) XX = VWPRT.right;
1105  return(XX);
1106 }
long X
Definition: actions.c:450
#define WNDW
Definition: mfbbasic.c:1093
#define VWPRT
Definition: mfbbasic.c:1094
int MFBScaleY ( int  Y)

Definition at line 1109 of file mfbbasic.c.

1111 {
1112  int YY;
1113 
1114  YY = (int)(((double)(Y-WNDW.bottom)*VWPRT.width)/WNDW.width) + VWPRT.bottom;
1115  if(YY < VWPRT.bottom) YY = VWPRT.bottom;
1116  else if(YY > VWPRT.top) YY = VWPRT.top;
1117  return(YY);
1118 }
#define WNDW
Definition: mfbbasic.c:1093
#define VWPRT
Definition: mfbbasic.c:1094
long Y
Definition: actions.c:450
int MFBSetALUMode ( int  mode)

Definition at line 423 of file mfbbasic.c.

437 {
438  char *cp;
439  switch(mode){
440  case MFBALUJAM:
441  cp = MFBFORMAT.setALUJAM;
442  break;
443  case MFBALUOR:
444  cp = MFBFORMAT.setALUOR;
445  break;
446  case MFBALUNOR:
447  cp = MFBFORMAT.setALUNOR;
448  break;
449  case MFBALUEOR:
450  cp = MFBFORMAT.setALUEOR;
451  break;
452  default:
453  cp = NULL;
454  }
455  if(cp == NULL || *cp == 0)
456  return(MFBBADALU);
457  MFBGenCode(cp);
458  return(MFBOK);
459 }
#define MFBALUEOR
Definition: mfb.h:448
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
#define MFBALUJAM
Definition: mfb.h:445
#define MFBALUNOR
Definition: mfb.h:447
#define MFBBADALU
Definition: mfb.h:516
#define NULL
Definition: spdefs.h:121
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
#define MFBALUOR
Definition: mfb.h:446
int MFBSetBlinker ( int  colorId,
int  r,
int  g,
int  b,
int  onFlag 
)

Definition at line 477 of file mfbbasic.c.

483 {
485  return(MFBNOBLNK);
486 
487  MFBCurrent->X = colorId;
489  MFBConvertToHLS(r,g,b);
490  }
491  else{
492  /* Normalize to 1000 */
493  MFBCurrent->Y = r * MFBCurrent->maxIntensity / 1000;
494  MFBCurrent->Z = g * MFBCurrent->maxIntensity / 1000;
495  MFBCurrent->T = b * MFBCurrent->maxIntensity / 1000;
496  }
497 
498  if(onFlag == ON) {
499  MFBGenCode(MFBFORMAT.blinkerON);
501  }
502  else {
503  MFBGenCode(MFBFORMAT.blinkerOFF);
505  }
507  return(MFBTMBLNK);
508  return(MFBOK);
509 }
#define MFBTMBLNK
Definition: mfb.h:507
#define MFBNOBLNK
Definition: mfb.h:506
void MFBConvertToHLS(int r, int g, int b)
Definition: mfbbasic.c:158
#define MFBOK
Definition: mfb.h:491
int maxIntensity
Definition: mfb.h:234
int T
Definition: mfb.h:222
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
int Z
Definition: mfb.h:222
Bool vltUseHLSBool
Definition: mfb.h:310
MFB * MFBCurrent
Definition: mfbbasic.c:31
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int numBlinkers
Definition: mfb.h:273
int X
Definition: mfb.h:222
Definition: cddefs.h:162
Definition: cddefs.h:227
#define ON
Definition: mfb.h:26
int maxBlinkers
Definition: mfb.h:257
Bool blinkersBool
Definition: mfb.h:338
int MFBSetChannelMask ( int  channelMask)

Definition at line 322 of file mfbbasic.c.

329 {
330 
331  /* Is channel mask already set? */
332  if(channelMask == MFBCurrent->channelMask)
333  return(MFBOK);
334  /* Are there channel or write-enable masks? */
336  return(MFBNOMASK);
337  else{
338  MFBCurrent->X = MFBCurrent->channelMask = channelMask;
339  MFBGenCode(MFBFORMAT.channelMaskSet);
340  }
341  return(MFBOK);
342 }
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
Bool channelMaskBool
Definition: mfb.h:313
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define MFBNOMASK
Definition: mfb.h:508
int channelMask
Definition: mfb.h:270
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int MFBSetColor ( int  colorId)

Definition at line 370 of file mfbbasic.c.

376 {
377 
378  /*
379  * Check if styleId is already the foreground color
380  */
381  if(colorId == MFBCurrent->fgColorId) return(MFBOK);
382 
383  if(colorId < 0 || colorId >= MFBCurrent->maxColors)
384  /* bad colorId */
385  return(MFBBADCST);
386  else {
387  MFBCurrent->X = MFBCurrent->fgColorId = colorId;
388  MFBGenCode(MFBFORMAT.setForegroundColor);
389  }
390  return(MFBOK);
391 }
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
#define MFBBADCST
Definition: mfb.h:500
int fgColorId
Definition: mfb.h:267
int maxColors
Definition: mfb.h:227
MFB * MFBCurrent
Definition: mfbbasic.c:31
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int MFBSetCursorColor ( int  colorId1,
int  colorId2 
)

Definition at line 463 of file mfbbasic.c.

469 {
470  MFBCurrent->cursorColor1Id = colorId1;
471  MFBCurrent->cursorColor2Id = colorId2;
472  return(MFBOK);
473 }
#define MFBOK
Definition: mfb.h:491
MFB * MFBCurrent
Definition: mfbbasic.c:31
int cursorColor2Id
Definition: mfb.h:266
int cursorColor1Id
Definition: mfb.h:265
MFBSetFillPattern ( int  styleId)

Definition at line 288 of file mfbbasic.c.

299 {
300 
301  /*
302  * Check if styleId is already the current fill style
303  */
304  if(styleId == MFBCurrent->fillPattern)
305  return(MFBOK);
306  if(styleId < 0 || styleId >= MFBCurrent->maxFillPatterns)
307  /* bad styleId */
308  return(MFBBADFST);
309  else {
310  MFBCurrent->X = MFBCurrent->fillPattern = styleId;
311  if(styleId == 0 && MFBFORMAT.setSolidFillPattern != NULL
312  && *MFBFORMAT.setSolidFillPattern != 0)
313  MFBGenCode(MFBFORMAT.setSolidFillPattern);
314  else
315  MFBGenCode(MFBFORMAT.setFillPattern);
316  }
317  return(MFBOK);
318 }
int maxFillPatterns
Definition: mfb.h:262
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
#define MFBBADFST
Definition: mfb.h:499
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
int fillPattern
Definition: mfb.h:268
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
void MFBSetGhost ( )

Definition at line 34 of file mfbbasic.c.

34 {}
MFBSetLineStyle ( int  styleId)

Definition at line 259 of file mfbbasic.c.

267 {
268  /*
269  * Check if styleId is already the current line style
270  */
272  return(MFBOK);
273  if(styleId < 0 || styleId >= MFBCurrent->maxLineStyles)
274  /* bad styleId */
275  return(MFBBADLST);
276  else {
277  MFBCurrent->X = MFBCurrent->lineStyle = styleId;
278  if(styleId == 0 && MFBFORMAT.setSolidLineStyle != NULL
279  && *MFBFORMAT.setSolidLineStyle != 0)
280  MFBGenCode(MFBFORMAT.setSolidLineStyle);
281  else
282  MFBGenCode(MFBFORMAT.setLineStyle);
283  }
284  return(MFBOK);
285 }
int lineStyle
Definition: mfb.h:269
int maxLineStyles
Definition: mfb.h:247
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
Bool reissueLineStyleBool
Definition: mfb.h:326
#define MFBBADLST
Definition: mfb.h:498
int MFBSetReadMask ( int  readMask)

Definition at line 346 of file mfbbasic.c.

353 {
354 
355  /* Is channel mask already set? */
356  if(readMask == MFBCurrent->readMask)
357  return(MFBOK);
358  /* Are there channel or write-enable masks? */
360  return(MFBNOMASK);
361  else{
362  MFBCurrent->X = MFBCurrent->readMask = readMask;
363  MFBGenCode(MFBFORMAT.readMaskSet);
364  }
365  return(MFBOK);
366 }
Bool readMaskBool
Definition: mfb.h:314
int readMask
Definition: mfb.h:271
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define MFBNOMASK
Definition: mfb.h:508
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
int MFBSetRubberBanding ( Bool  RubberBandingBool,
int  X,
int  Y 
)

Definition at line 513 of file mfbbasic.c.

522 {
523  if(MFBFORMAT.enableRubberBanding == NULL
524  || *MFBFORMAT.enableRubberBanding == 0)
525  return(MFBNORBND);
526  if(RubberBandingBool){
527  MFBCurrent->X = X;
528  MFBCurrent->Y = Y;
529  MFBGenCode(MFBFORMAT.movePenSequence);
530  MFBGenCode(MFBFORMAT.enableRubberBanding);
531  }
532  else
533  MFBGenCode(MFBFORMAT.disableRubberBanding);
534  return(MFBOK);
535 }
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
long X
Definition: actions.c:450
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
#define MFBNORBND
Definition: mfb.h:515
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
long Y
Definition: actions.c:450
int MFBSetTextMode ( Bool  destructiveBool)

Definition at line 395 of file mfbbasic.c.

404 {
405  if(MFBCurrent->textMode != (int)destructiveBool) {
406  if(destructiveBool){
408  return(MFBBADTM1);
409  MFBGenCode(MFBFORMAT.replaceON);
410  }
411  else{
413  return(MFBBADTM2);
414  MFBGenCode(MFBFORMAT.overstrikeON);
415  }
416  MFBCurrent->textMode = (int)destructiveBool;
417  }
418  return(MFBOK);
419 }
#define MFBBADTM1
Definition: mfb.h:501
#define MFBOK
Definition: mfb.h:491
#define MFBFORMAT
Definition: mfbbasic.c:28
#define MFBBADTM2
Definition: mfb.h:502
MFB * MFBCurrent
Definition: mfbbasic.c:31
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int textMode
Definition: mfb.h:272
Bool replaceTextBool
Definition: mfb.h:334
Bool overstrikeTextBool
Definition: mfb.h:335
void MFBSetViewport ( int  left,
int  bottom,
int  right,
int  top 
)

Definition at line 1141 of file mfbbasic.c.

1143 {
1144  VWPRT.bottom = bottom;
1145  VWPRT.top = top;
1146  VWPRT.left = left;
1147  VWPRT.right = right;
1148  VWPRT.length = VWPRT.right - VWPRT.left;
1149  VWPRT.width = VWPRT.top - VWPRT.bottom;
1150 }
#define VWPRT
Definition: mfbbasic.c:1094
void MFBSetWindow ( int  left,
int  bottom,
int  right,
int  top 
)

Definition at line 1153 of file mfbbasic.c.

1155 {
1156  WNDW.bottom = bottom;
1157  WNDW.top = top;
1158  WNDW.left = left;
1159  WNDW.right = right;
1160  WNDW.length = WNDW.right - WNDW.left;
1161  WNDW.width = WNDW.top - WNDW.bottom;
1162 }
#define WNDW
Definition: mfbbasic.c:1093
void MFBText ( char *  text,
int  x,
int  y,
int  phi 
)

Definition at line 926 of file mfbbasic.c.

935 {
936  char *c;
937 
938 #ifdef DEBUG
939  MFBCurrent->nChars += strlen(text);
940 #endif
941  if((phi != 0) && (MFBCurrent->textRotateBool == true)){
942  MFBCurrent->X = phi;
943  MFBGenCode(MFBFORMAT.rotateTextSequence);
944  }
945 
946  /* Move to (x + GTW),(Y + GTH). */
949 
950  /* Get ready for graphics text. */
951  c = text;
952  MFBCurrent->Z = 0;
953  while(*c++ != 0) (MFBCurrent->Z)++;
954 
955  MFBGenCode(MFBFORMAT.graphicsTextStart);
956 
957  /* Output the text. */
958  while(*text) MFBPutchar(*text++);
959 
960  /* Finish the graphics text */
961  MFBGenCode(MFBFORMAT.graphicsTextEnd);
962 
963  /* rotate text back to zero */
964  if((phi != 0) && (MFBCurrent->textRotateBool == true)){
965  MFBCurrent->X = 0;
966  MFBGenCode(MFBFORMAT.rotateTextSequence);
967  }
968 }
Bool textRotateBool
Definition: mfb.h:333
double phi()
#define MFBFORMAT
Definition: mfbbasic.c:28
int Y
Definition: mfb.h:222
MFBPutchar(char c)
Definition: mfbio.c:121
int Z
Definition: mfb.h:222
int fontXOffset
Definition: mfb.h:252
MFB * MFBCurrent
Definition: mfbbasic.c:31
int fontYOffset
Definition: mfb.h:253
static double c
Definition: vectors.c:16
int nChars
Definition: mfb.h:281
void MFBGenCode(char *PM)
Definition: mfbgnc.c:99
int X
Definition: mfb.h:222
void MFBZeroCounters ( )

Definition at line 213 of file mfbbasic.c.

213  {
214 #ifdef DEBUG
215  if(MFBCurrent == NULL) return;
219 #endif
220 }
int nLines
Definition: mfb.h:283
int sumLineLength
Definition: mfb.h:283
int nBoxes
Definition: mfb.h:282
MFB * MFBCurrent
Definition: mfbbasic.c:31
#define NULL
Definition: spdefs.h:121
int nChars
Definition: mfb.h:281
int sumBoxArea
Definition: mfb.h:282
void SetCurrentMFB ( MFB mfb)

Definition at line 198 of file mfbbasic.c.

207 {
208  MFBCurrent = mfb;
209 }
MFB * MFBCurrent
Definition: mfbbasic.c:31

Variable Documentation

int LastX

Definition at line 652 of file mfbbasic.c.

int LastY

Definition at line 652 of file mfbbasic.c.

MFB* MFBCurrent

Definition at line 31 of file mfbbasic.c.