Beispiel #1
0
static void StringsDownOrderUpdate (int xLeft, int yTop, int nScaling)
{
    STRING *p;
    int nString;

    struct textsettings ts;
    int x, y;
    char szTextBuffer [128];

    LT_GraphicsClearScreen ();

    _gettextsettings (&ts);
    _setcharsize (ts.height / 2, ts.width / 2);
    _settextalign (_CENTER, _HALF);

    for (nString = 1, p = pStringsDownList; p != NULL; p = p -> pUp, nString++)
    {
        _setcolor (p -> uFlags & SF_NEED_DELETE ? 15 : NUMBER_TO_COLOR (nString));
        _rectangle (_GBORDER,
                    (p -> xLeft   - xLeft) / nScaling,
                    (p -> yTop    - yTop)  / nScaling,
                    (p -> xRight  - xLeft) / nScaling,
                    (p -> yBottom - yTop)  / nScaling);

        x = ((p -> xLeft + p -> xRight)  / 2 - xLeft) / nScaling;
        y = ((p -> yTop  + p -> yBottom) / 2 - yTop)  / nScaling;

        _setcolor (15);
        sprintf (szTextBuffer, "%d", nString);
        _grtext (x, y, szTextBuffer);
    }

    _setcharsize (ts.height, ts.width);
}
Beispiel #2
0
static void Do_Demo1( void )
/*========================*/
{
    int                 width, y;

/*  sweep text in from top & bottom of screen, gradually increasing
    character size as the center of the screen is approached. */

    _setcolor( TextColour );
    width = 0;
    for( y = 5; y < VC.numypixels / 2 - 10; y += 5, ++width ) {
        DrawText( width, y );
    }

/*  draw text over final positions using a different color index */

    _setcolor( TextColour2 );
    DrawText( width, y );

/*  draw a border around the screen */

    _setcolor( BorderColour );
    _rectangle( _GBORDER, 0, 0, VC.numxpixels - 1, VC.numypixels - 1 );
    if( VC.adapter > _MCGA ) {
        FadeColors();
    }
}
Beispiel #3
0
int main( const int argc, const char **argv)
{
   int function = atoi( argv[1]), i;
   char buff[200];
   FILE *ifile = fopen( "loneos.phot", "rb");
   double limits[12] = { -.4, 3.9, -.4, 2.,        /* V-I to B-V */
                         -.5, 4.2, -.4, 2.1,       /* V-I to V-R */
                         -.3, 2.,  -.4, 2.2 };     /* V-R to B-V */
   double *lim = limits + function * 4;
   int xcolumns[3] = { 75, 75, 69 };
   int ycolumns[3] = { 63, 69, 63 };

   _setvideomode( _VRES16COLOR);
   _setcolor( 2);
   for( i = 0; i < 640; i++)
      {
      double ocolor, icolor = lim[0] + (lim[1] - lim[0]) * (double)i / 640.;

      if( function == 0)
         ocolor = v_minus_i_to_b_minus_v( icolor);
      else if( function == 1)
         ocolor = v_minus_i_to_v_minus_r( icolor);
      else
         ocolor = v_minus_r_to_b_minus_v( icolor);
      _setpixel( (short)i, (short)( 480. * (ocolor-lim[3]) / (lim[2]-lim[3])));
      }

   _setcolor( 3);
   while( fgets( buff, sizeof( buff), ifile))
      {
      if( buff[xcolumns[function]] == '.' && buff[ycolumns[function]] == '.')
         {
         double icolor = atof( buff + xcolumns[function] - 2);
         double ocolor = atof( buff + ycolumns[function] - 2);
         int xpixel = (int)( 640. * (icolor-lim[0]) / (lim[1]-lim[0]));
         int ypixel = (int)( 480. * (ocolor-lim[3]) / (lim[2]-lim[3]));
         short ix, iy;
         short deltas[9 * 2] = { 0,0, 1,0, 0,1, -1,0, 0,-1,
                        1,1, 1,-1, -1,-1, -1,1 };

         for( i = 0; i < 18; i += 2)
            {
            ix = (short)( xpixel + deltas[i]);
            iy = (short)( ypixel + deltas[i + 1]);
            if( !_getpixel( ix, iy))
               i = 99;
            }
         if( i != 18)
            _setpixel( ix, iy);
         }
      buff[xcolumns[function]] = buff[ycolumns[function]] = ' ';
      }
   fclose( ifile);

   getch( );
   _setvideomode( _DEFAULTMODE);
   return( 0);
}
Beispiel #4
0
static void RasterUpdate (int xLeft, int yTop, int nScaling)
{
    int x, y;
    int nStep;

    LT_GraphicsClearScreen ();

    nStep = MIN (FIELD_WIDTH / nRasterWidth, FIELD_HEIGHT / nRasterHeight);

    if (nStep == 0) nStep = 1;

    _setcolor (15);
    _rectangle (_GFILLINTERIOR,
                (0                     - xLeft) / nScaling,
                (0                     - yTop)  / nScaling,
                (nRasterWidth  * nStep - xLeft) / nScaling,
                (nRasterHeight * nStep - yTop)  / nScaling);

    _setcolor (0);

    for (x = 0; x < nRasterWidth; x++)
    {
        for (y = 0; y < nRasterHeight; y++)
        {
            if ((pRaster [y * nRasterByteWidth + x / 8] << x % 8) & 0x80)
            {
                _rectangle (_GFILLINTERIOR,
                    (x       * nStep - xLeft) / nScaling,
                    (y       * nStep - yTop)  / nScaling,
                    ((x + 1) * nStep - xLeft) / nScaling,
                    ((y + 1) * nStep - yTop)  / nScaling);
            }
        }
    }

    _setcolor (7);

    for (x = 0; x <= nRasterWidth; x++)
    {
        _moveto ((x * nStep             - xLeft) / nScaling,
                 (0                     - yTop)  / nScaling);
        _lineto ((x * nStep             - xLeft) / nScaling,
                 (nRasterHeight * nStep - yTop)  / nScaling);
    }

    for (y = 0; y <= nRasterHeight; y++)
    {
        _moveto ((0                    - xLeft) / nScaling,
                 (y * nStep            - yTop)  / nScaling);
        _lineto ((nRasterWidth * nStep - xLeft) / nScaling,
                 (y * nStep            - yTop)  / nScaling);
    }
}
Beispiel #5
0
main(int argc,char *argv[])
{
	int	a;
	FILE	*f1;
	if(argc==1)
	{
		printf("usage: FONT <srclbm> <desttmpfont>");
		return(0);
	}
	_setvideomode(_VRES16COLOR);
	for(a=0;a<256;a++)
	{
		f_off[a]=0;
		f_wid[a]=0;
		f_hig[a]=0;
	}
	avercnt=0; averwid=0;
	out=fopen(argv[2],"wb");
	putw(0x1a1a,out);
	putw(tablep,out);
	fwrite(tablex,1,256,out);
	fwrite(tabley,1,256,out);
	f1=fopen(argv[1],"rb");
	readlbm(f1);
	{
		char buf[64];
		int x0,y0,x,y,a;
		for(y0=2;y0<7*8-2;y0+=8)
		  for(x0=0;x0<56*8;x0+=8)
		{
			for(a=x=0;x<8;x++) for(y=0;y<8;y++)
			{
				if((buf[x+y*8]=_getpixel(x0+x,y0+y))==0) a=1;
			}
			if(a)
			{
				tablex[tablep]=x0/8;
				tabley[tablep++]=(y0-2)/8;
				for(y=0;y<8;y++) 
				{
					for(a=x=0;x<8;x++)
					{
						if(!buf[x+y*8]) a+=128>>x;
					}
					putc(a,out);
				}
				_setcolor(15);
			}
			else _setcolor(8);
			_setpixel(x0,y0);
		}
	}
Beispiel #6
0
static void _DrawPercentLabel( short xc, short yc, short xradius,
            short yradius, float xratio, float yratio, float value )
//==================================================================

/*  Draws the percents on the pie graph.  This function was created to
    save some space.
*/

{
    short               x, y;
    short               length;
    short               pixels;
    char                buffer[ 10 ];

    _setcolor( _PGPalette[ 1 ].color );
    _StringPrint( buffer, _PG_DECFORMAT, 1, 100 * value );
    length = strlen( buffer );
    buffer[ length ] = '%';
    buffer[ length + 1 ] = '\0';
    pixels = _getgtextextent( buffer );
    x = xc + xratio * ( _CharWidth + xradius );
    y = yc - yratio * ( 3 * _CharHeight / 2 + yradius ) - _CharHeight / 2;
    if( xratio > 0 ) {
        _moveto( x, y );
    } else {
        _moveto( x - pixels, y );
    }
    _outgtext( buffer );
}
Beispiel #7
0
void main(void)
{
    int x1, y1, x2, y2, color, index;
    
    _setvideomode(_VRES16COLOR);
    
    //draw 10,000 points
    for(index = 0; index < 1000; index++)
    {
        x1 = rand() % 640;
        y1 = rand() % 480;
        x2 = rand() % 640;
        y2 = rand() % 480;
        
        color = rand() % 16;
        
        _setcolor(color);
        _moveto(x1,y1);
        _lineto(x2,y2);
    }
    
    while(!kbhit()) {}
    
    _setvideomode(_DEFAULTMODE);
}
Beispiel #8
0
static void RootsUpdate (int xLeft, int yTop, int nScaling)
{
    ROOT *pRoot;

    LT_GraphicsClearScreen ();

    for (pRoot = cf::Roots::first(); pRoot < pAfterRoots; pRoot++)
    {
        int nColor = 8;

        if (pRoot -> bType & ROOT_LETTER)       nColor |= 1;
        if (pRoot -> bType & ROOT_RECOGNIZED)   nColor |= 2;
        if (pRoot->isLayoutDust())              nColor |= 4;

        if (pRoot -> bType & ROOT_DEBUG)        nColor = 14;

        _setcolor (nColor);

        _rectangle (_GFILLINTERIOR,
            (pRoot -> xColumn - xLeft) / nScaling,
            (pRoot -> yRow    - yTop)  / nScaling,
            (pRoot -> xColumn + pRoot ->nWidth  - 1 - xLeft) / nScaling,
            (pRoot -> yRow    + pRoot ->nHeight - 1 - yTop)  / nScaling);
    }

    SeparatorsOutput (xLeft, yTop, nScaling);
}
Beispiel #9
0
static void BlocksUpdate (int xLeft, int yTop, int nScaling)
{
    BLOCK *p;
    ROOT *pRoot;
    int  nColor;

    LT_GraphicsClearScreen ();

    for (p = pBlocksList; p != NULL; p = p -> pNext)
    {
        nColor = NUMBER_TO_COLOR (p -> nNumber) |
                 (((p -> uFlags & BF_NOT_BREAK_BLOCK) != 0) << 3);

        _setcolor (nColor);
        BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);

        SeparatorOutput (p -> pUpSep,    nColor, SEPOUT_DASH_1, xLeft, yTop, nScaling);
        SeparatorOutput (p -> pDownSep,  nColor, SEPOUT_DASH_2, xLeft, yTop, nScaling);
        SeparatorOutput (p -> pLeftSep,  nColor, SEPOUT_DASH_1, xLeft, yTop, nScaling);
        SeparatorOutput (p -> pRightSep, nColor, SEPOUT_DASH_2, xLeft, yTop, nScaling);
    }

    for (pRoot = cf::Roots::first(); pRoot < pAfterRoots; pRoot++)
    {
        if (pRoot -> nBlock == REMOVED_BLOCK_NUMBER)
        {

        }
        else
        {
            if (pRoot -> nBlock == DUST_BLOCK_NUMBER)
                _setcolor (15);
            else
                _setcolor (NUMBER_TO_COLOR (pRoot -> nBlock));

            _rectangle (_GFILLINTERIOR,
                (pRoot -> xColumn - xLeft) / nScaling,
                (pRoot -> yRow    - yTop)  / nScaling,
                (pRoot -> xColumn + pRoot ->nWidth  - 1
                                        - xLeft) / nScaling,
                (pRoot -> yRow    + pRoot ->nHeight - 1
                                        - yTop)  / nScaling);
        }
    }
}
Beispiel #10
0
void Org1D::plotAt(int X, int Y)
{   // plots generations at X, Y
    int gen, at;
    for (gen = 0; gen < numOfGen; gen++)
        for (at = 0; at < size[gen]; at++)
        {   // draw the indicated pixel
            _setcolor((vc.numcolors-1)*cells[gen][at]/maxState);
            _setpixel(X-size[gen]/2+at, Y+numOfGen/2-gen);
        };  // for
};  // Org1D::plotAt()
Beispiel #11
0
void draw_color_table() {
	_clearscreen(_GCLEARSCREEN);

	for (unsigned int c = 0; c < 256; ++c) {
		_setcolor(c);
		int x = (c % 16) * 10;
		int y = (c >> 4) * 10;
		_rectangle(_GFILLINTERIOR, x, y, x+10, y+10);
	}
}
Beispiel #12
0
void _GrClear( short x1, short y1, short x2, short y2 )
/*=====================================================

    Clear area of screen in graphics mode. */

{
    unsigned char       prev_mask[ MASK_LEN ];
    grcolor             prev_colour;
    short               prev_action;

    prev_action = _setplotaction( _GPSET );
    _getfillmask( prev_mask );
    _setfillmask( NULL );
    prev_colour = _getcolor();
    _setcolor( 0 );
    _L1Block( x1, y1, x2, y2 );
    _setcolor( prev_colour );
    _setfillmask( prev_mask );
    _setplotaction( prev_action );
}
Beispiel #13
0
static void PieGraph( void )
/*==========================

    Draw pie graph. */

{
    int                 i;
    float               x1, y1;
    float               x2, y2;
    float               x3, y3;
    float               x4, y4;
    float               xc, yc;
    float               xradius, yradius;
    float               theta;
    long                total;

/*  Calculate data for pie graph. */

    total = 0;
    for( i = 0; i < NUMSECT; ++i ) {
        total += Values[ i ];
    }

/*  Calculate centre and radius of pie */

    xc = 0.75;
    yc = 0.45;
    xradius = 0.20;
    yradius = 0.20 * 4 / 3;

/*  Calculate bounding rectangle */

    x1 = xc - xradius;
    y1 = yc - yradius;
    x2 = xc + xradius;
    y2 = yc + yradius;

/*  Draw the slices */

    x3 = xc + xradius;
    y3 = yc;
    theta = 0.0;
    for( i = 0; i < NUMSECT; ++i ) {
        theta += Values[ i ] * 2 * PI / total;
        x4 = xc + xradius * cos( theta );
        y4 = yc + yradius * sin( theta );
        _setcolor( i % ( VC.numcolors - 1 ) + 1 );
        _setfillmask( Masks[ i % 8 ] );
        _pie_w( _GFILLINTERIOR, x1, y1, x2, y2, x3, y3, x4, y4 );
        _pie_w( _GBORDER, x1, y1, x2, y2, x3, y3, x4, y4 );
        x3 = x4;
        y3 = y4;
    }
}
Beispiel #14
0
void press_key()
//==============

//  Display a message and wait for the user to press a key

{
    int                 len;
    char                *msg;
    struct _fontinfo    info;

    _getfontinfo( &info );
    msg = " Press any key ";
    len = _getgtextextent( msg );
    _setcolor( 4 );
    _rectangle( _GFILLINTERIOR, xmax - len, 0,
                                xmax - 1, info.pixheight + 2 );
    _setcolor( 15 );
    _moveto( xmax - len, 1 );
    _outgtext( msg );
    getch();
}
Beispiel #15
0
static void Title( void )
/*=======================

    Draw main title and graph boxes. */

{
    _setcolor( TitleColour );
    _settextalign( _CENTER, _TOP );
    _setcharsize_w( 0.08, 1.0 / strlen( Main_Title ) );
    _grtext_w( 0.5, 1.0, Main_Title );
    _rectangle_w( _GBORDER, 0.00, 0.00, 0.49, 0.90 );     // left half
    _rectangle_w( _GBORDER, 0.51, 0.00, 1.00, 0.90 );     // right half
}
Beispiel #16
0
static void BlockRectangle (BLOCK *p, short fill,
                            int xLeft, int yTop, int nScaling)
{
    switch (p -> Type)
    {
        case BLOCK_NULL:
            return;

        case BLOCK_PICTURE:
        case BLOCK_TEXT:
            _rectangle (fill,
                (p -> Rect.xLeft   - xLeft) / nScaling,
                (p -> Rect.yTop    - yTop)  / nScaling,
                (p -> Rect.xRight  - xLeft) / nScaling,
                (p -> Rect.yBottom - yTop)  / nScaling);
            break;

        case BLOCK_HORZ_SEPARATOR:
        case BLOCK_VERT_SEPARATOR:
            _setcolor (15);
            _rectangle (_GBORDER,
                (p -> Rect.xLeft   - xLeft) / nScaling,
                (p -> Rect.yTop    - yTop)  / nScaling,
                (p -> Rect.xRight  - xLeft) / nScaling,
                (p -> Rect.yBottom - yTop)  / nScaling);
            break;

        case BLOCK_RECT_SEPARATOR:
            _setcolor (14);
            _rectangle (_GBORDER,
                (p -> Rect.xLeft   - xLeft) / nScaling + 3,
                (p -> Rect.yTop    - yTop)  / nScaling + 3,
                (p -> Rect.xRight  - xLeft) / nScaling - 3,
                (p -> Rect.yBottom - yTop)  / nScaling - 3);
            break;
    }
}
Beispiel #17
0
void main(void)
{
    int x, y, color, index;
    
    _setvideomode(_VRES16COLOR);
    
    //draw 10,000 points
    for(index = 0; index < 10000; index++)
    {
        x = rand() % 640;
        y = rand() % 480;
        color = rand() % 16;
        _setcolor(color);
        _setpixel(x,y);
    }
    
    while(!kbhit()) {}
    
    _setvideomode(_DEFAULTMODE);
}
Beispiel #18
0
static void SeparatorOutput (SEPARATOR *pSep,
                             int nColor, int OutputMode,
                             int xLeft, int yTop, int nScaling)
{
    if (pSep == NULL)
        return;

    _setcolor (nColor);

    switch (OutputMode)
    {
        case SEPOUT_LINE:   break;
        case SEPOUT_DASH_1: _setlinestyle (0xf0f0); break;
        case SEPOUT_DASH_2: _setlinestyle (0x0f0f); break;
    }

    switch (pSep -> Type)
    {
        default:
            break;

        case SEP_VERT:
        case SEP_HORZ:
            _moveto ((pSep -> xBegin - xLeft) / nScaling,
                     (pSep -> yBegin - yTop)  / nScaling);
            _lineto ((pSep -> xEnd   - xLeft) / nScaling,
                     (pSep -> yEnd   - yTop)  / nScaling);
            break;

        case SEP_RECT:
            _rectangle (_GBORDER,
                        (pSep -> xBegin - xLeft) / nScaling + 3,
                        (pSep -> yBegin - yTop)  / nScaling + 3,
                        (pSep -> xEnd   - xLeft) / nScaling - 3,
                        (pSep -> yEnd   - yTop)  / nScaling - 3);
            break;
    }

    _setlinestyle (0xffff);
}
/* Grafikbildschirm einrichten */
void SimBildschirmmaske(void)
{
  char buf_l[20],buf_d[20];

  sprintf(buf_l,"%6.2f",(float)laenge/100.0F);
  sprintf(buf_d,"%6.2f",(float)durchm/100.0F);

  _setcolor(7);
  _moveto(0,431);
  _lineto(640,431);
  _settextposition(1,1);

   _outtext(" Simulator:   � Pausefunktion: Stop stArt � Trace: troN troFf | Ende: ESC\n");
  _moveto(0,7);
  _lineto(640,7);
  _outtext("X-Drm �:                  Werkzeug: T01 (Ref)        Koordinaten:INC \n");
  _outtext("Z-Pos  :                  Trace   : Aus \n");
  _outtext("\nWerkst�ck: l=");
  _outtext(buf_l);
  _outtext("mm  �=");
  _outtext(buf_d);
  _outtext("mm            Status:\nMeldung  :");

  _moveto(0,7);
  _lineto(640,7);
  _moveto(0,48);
  _lineto(640,48);
  _moveto(0,175);
  _lineto(640,175);

  /* Graphicfenster */
  _setviewport(0,49,639,174);
  _setvieworg(0,50);

  Zeichne_stueck();

  /* Maschinen-NP */
  _ellipse(_GFILLINTERIOR,2,2,-2,-2);
}
Beispiel #20
0
static void DoBars( float xleft, float ybottom, float xlen, float ylen )
/*======================================================================

    Draw bars of graph. */

{
    int                 i;
    float               x1, y1;
    float               x2, y2;
    float               bar_width;

    bar_width = ( 2 * xlen ) / ( 3 * NUMSECT + 1 );
    y1 = ybottom + 1.0 / VC.numypixels;
    for( i = 0; i < NUMSECT; ++i ) {
        x1 = xleft + ( 3 * i + 1 ) * bar_width / 2;
        x2 = x1 + bar_width;
        y2 = y1 + ylen * Values[ i ] / 100;
        _setcolor( i % ( VC.numcolors - 1 ) + 1 );
        _setfillmask( Masks[ i % 8 ] );
        _rectangle_w( _GFILLINTERIOR, x1, y1, x2, y2 );
        _rectangle_w( _GBORDER, x1, y1, x2, y2 );
    }
}
Beispiel #21
0
_WCRTLINK short _WCI86FAR _CGRAPH _pg_vlabelchart( chartenv _WCI86FAR *env,
                            short x, short y, short color, char _WCI86FAR *label )
//===========================================================================

/*  Draws vertical label on the chart.  Coordinates are relative to the
    upper left corner of the chartwindow.   */

{
    char                buffer[ 2 ];

    _setcolor( _PGPalette[ color ].color );
    buffer[ 1 ] = '\0';
    x += env->chartwindow.x1;
    y += env->chartwindow.y1;
    while( *label != '\0' ) {
        buffer[ 0 ] = *label;
        _moveto( x + ( _CharWidth - _getgtextextent( buffer ) ) / 2, y );
        _outgtext( buffer );
        ++label;
        y += _CharHeight;
    }
    return( 0 );
}
Beispiel #22
0
void drawTree(int leftBranch, int midBranch, int rightBranch)
{   // draws a tree on the screen
    _clearscreen(_GCLEARSCREEN);
    _setcolor(15);
    _setlinestyle(0xAAAA);
    _moveto(vc.numxpixels/2, vc.numypixels);
    _lineto(vc.numxpixels/2, vc.numypixels*3/4);
    _lineto(vc.numxpixels/6, vc.numypixels/3);
    _moveto(vc.numxpixels/2, vc.numypixels*3/4);
    _lineto(vc.numxpixels/2, vc.numypixels/4);
    _moveto(vc.numxpixels/2, vc.numypixels*3/4);
    _lineto(vc.numxpixels*5/6, vc.numypixels/3);
    if (leftBranch)
    {   _moveto(vc.numxpixels/6, vc.numypixels/3);
        _lineto(vc.numxpixels/18, 0);
        _moveto(vc.numxpixels/6, vc.numypixels/3);
        _lineto(vc.numxpixels*3/18, 0);
        _moveto(vc.numxpixels/6, vc.numypixels/3);
        _lineto(vc.numxpixels*5/18, 0);
    };  // if
    if (midBranch)
    {   _moveto(vc.numxpixels/2, vc.numypixels/4);
        _lineto(vc.numxpixels*7/18, 0);
        _moveto(vc.numxpixels/2, vc.numypixels/4);
        _lineto(vc.numxpixels*9/18, 0);
        _moveto(vc.numxpixels/2, vc.numypixels/4);
        _lineto(vc.numxpixels*11/18, 0);
    };  // if
    if (rightBranch)
    {   _moveto(vc.numxpixels*5/6, vc.numypixels/3);
        _lineto(vc.numxpixels*13/18, 0);
        _moveto(vc.numxpixels*5/6, vc.numypixels/3);
        _lineto(vc.numxpixels*15/18, 0);
        _moveto(vc.numxpixels*5/6, vc.numypixels/3);
        _lineto(vc.numxpixels*17/18, 0);
    };  // if
};  // drawTree
Beispiel #23
0
static void _DrawPie( chartenv _WCI86FAR* env,
                      float _WCI86FAR *values, short _WCI86FAR *explode, short n )
//======================================================================

/*  Uses shorts to graph the pie.

    +-----------+   -circle initially takes up 90% of the datawindow.
    |    |    |   -space is made ( maxlength ) for percent if needed
    |  |--  |   -initial vector is ( 1, 0 )
    | +- |   -percents are printed out so that they either start or
    |  |  |    end at the bisecting angle of the segment
    |    |    |   -exploded segments are placed 1/10th of the radius away
    +-----------+    from the center along the bisecting angle of the segment
*/

{
    short               xradius, yradius;
    short               newx, newy;
    short               oldx, oldy;
    short               xc, yc;
    short               x1, y1;
    short               x2, y2;
    float               xratio, yratio;
    short               xincrement, yincrement;
    float               newangle, oldangle;
    float               total = 0;
    float               running_total = 0;
    float               tmp;
    short               i;

    _Radius( env, &xradius, &yradius );
    oldangle = 0;
    xc = ( env->datawindow.x1 + env->datawindow.x2 ) / 2;
    yc = ( env->datawindow.y1 + env->datawindow.y2 ) / 2;
    x1 = xc - xradius;
    y1 = yc - yradius;
    x2 = xc + xradius;
    y2 = yc + yradius;
    oldx = x2;
    oldy = yc;
    for( i = 0; i < n; i++ ) {
        if( values[ i ] != _PG_MISSINGVALUE && values[ i ] > 0 ) {
            total += values[ i ];
        }
    }
    _setlinestyle( _PGPalette[ 1 ].style );
    for( i = 0; i < n; ++i ) {
        if( values[ i ] != _PG_MISSINGVALUE && values[ i ] > 0 ) {
            running_total += values[ i ];
            newangle = 2.0f * PI * running_total / total;
//          newx = xc + cos( newangle ) * xradius;
            tmp = newangle;
            _GR_cos( &tmp );        // tmp = cos( tmp )
            newx = xc + tmp * xradius;
//          newy = yc - sin( newangle ) * yradius;
            tmp = newangle;
            _GR_sin( &tmp );        // tmp = sin( tmp )
            newy = yc - tmp * yradius;
//          xratio = cos( ( newangle + oldangle ) / 2 );
            xratio = ( newangle + oldangle ) / 2;
            _GR_cos( &xratio );    // xratio = cos( xratio )
//          yratio = sin( ( newangle + oldangle ) / 2 );
            yratio = ( newangle + oldangle ) / 2;
            _GR_sin( &yratio );    // yratio = sin( yratio )
            _setcolor( _PGPalette[ i % 15 + 1 ].color );
            _setfillmask( _PGPalette[ i % 15 + 1 ].fill );
            if( !explode[ i ] ) {
                xincrement = 0;
                yincrement = 0;
            } else {
                xincrement = xratio * xradius / 10;
                yincrement = yratio * yradius / 10;
            }
            _DrawTwoPies( x1, y1, x2, y2, oldx, oldy, newx, newy,
                                          xincrement, yincrement );
            if( env->chartstyle == _PG_PERCENT ) {
                _DrawPercentLabel( xc + xincrement, yc - yincrement, xradius,
                        yradius, xratio, yratio, values[ i ] / total );
            }
            oldangle = newangle;
            oldx = newx;
            oldy = newy;
        }
    }
}
Beispiel #24
0
void LT_GraphicsTitle (const char *pTitle)
{
    _setcolor (15);
    _settextalign (_CENTER, _HALF);
    _grtext (320, 450, pTitle);
}
Beispiel #25
0
static void BreakingUpdate (int xLeft, int yTop, int nScaling)
{
    int x, y;
    int nStep;

    LT_GraphicsClearScreen ();

    nStep = MIN (FIELD_WIDTH / nRasterWidth, FIELD_HEIGHT / nRasterHeight);

    if (nStep == 0)
        nStep = 1;

    _setcolor (15);
    _rectangle (_GFILLINTERIOR,
                (0                     - xLeft) / nScaling,
                (0                     - yTop)  / nScaling,
                (nRasterWidth  * nStep - xLeft) / nScaling,
                (nRasterHeight * nStep - yTop)  / nScaling);

    for (x = 0; x < nRasterWidth; x++)
    {
        for (y = 0; y < nRasterHeight; y++)
        {
            if ((pRaster [y * nRasterByteWidth + x / 8] << x % 8) & 0x80)
                _setcolor (0);
            else if (y == yRasterBreakLine)
                _setcolor (12);
            else if (y >= yRasterUpBreakLimit && y <= yRasterDownBreakLimit)
                _setcolor (14);
            else
                continue;

            _rectangle (_GFILLINTERIOR,
                (x       * nStep - xLeft) / nScaling,
                (y       * nStep - yTop)  / nScaling,
                ((x + 1) * nStep - xLeft) / nScaling,
                ((y + 1) * nStep - yTop)  / nScaling);
        }
    }

    _setcolor (7);

    for (x = 0; x <= nRasterWidth; x++)
    {
        _moveto ((x * nStep             - xLeft) / nScaling,
                 (0                     - yTop)  / nScaling);
        _lineto ((x * nStep             - xLeft) / nScaling,
                 (nRasterHeight * nStep - yTop)  / nScaling);
    }

    for (y = 0; y <= nRasterHeight; y++)
    {
        _moveto ((0                    - xLeft) / nScaling,
                 (y * nStep            - yTop)  / nScaling);
        _lineto ((nRasterWidth * nStep - xLeft) / nScaling,
                 (y * nStep            - yTop)  / nScaling);
    }

    _setcolor (9);

    for (y = 0; y <= nRasterHeight; y++)
    {
        _rectangle (_GFILLINTERIOR,
            ((nRasterWidth + 1) * nStep - xLeft) / nScaling,
            (y                  * nStep - yTop)  / nScaling,
            ((aRasterHystogram [y] + nRasterWidth + 1)
                                * nStep - xLeft) / nScaling,
            ((y + 1)            * nStep - yTop)  / nScaling);
    }
}
/* Stahl Nummer "tool" zeichen */
void Zeichne_Stahl(short xp,short yp,char tool,short color)
{
   _setcolor(color);
   switch(tool)
   {
      case 1:/* rechter Seitenstahl */
	  {
	    _moveto(xp,yp);
	    _lineto(xp+0,yp+12);
	    _lineto(xp+24,yp+18);
	    _lineto(xp+24,yp+8);
	    _lineto(xp,yp);

	    _moveto(xp+8,yp+14);
	    _lineto(xp+8,yp+50);	   /* 3 3 -> x4 y2 */
	    _moveto(xp+24,yp+10);
	    _lineto(xp+40,yp+12);
	    _lineto(xp+40,yp+50);
	  }
	  break;
      case 2:/* linker Seitenstahl */
	  {
	    _moveto(xp+56,yp);
	    _lineto(xp+32,yp+8);
	    _lineto(xp+32,yp+20);
	    _lineto(xp+56,yp+12);
	    _lineto(xp+56,yp);

	    _moveto(xp+48,yp+14);
	    _lineto(xp+48,yp+50);
	    _moveto(xp+32,yp+10);
	    _lineto(xp+16,yp+14);
	    _lineto(xp+16,yp+50);
	  }
	  break;
      case 3:/* neutraler Drehstahl */
	  {
	    _moveto(xp+28,yp);
	    _lineto(xp+16,yp+11);
	    _lineto(xp+28,yp+22);
	    _lineto(xp+40,yp+11);
	    _lineto(xp+28,yp);

	    _moveto(xp+16,yp+13);
	    _lineto(xp+9,yp+16);
	    _lineto(xp+9,yp+50);
	    _moveto(xp+40,yp+13);
	    _lineto(xp+50,yp+16);
	    _lineto(xp+50,yp+50);
	  }
	  break;
      case 4:/* Gewindestahl aussen rechts */
	  {
	    _moveto(xp+8,yp);
	    _lineto(xp+16,yp+6);
	    _lineto(xp+24,yp+6);
	    _lineto(xp+32,yp+8);
	    _lineto(xp+48,yp+8);
	    _lineto(xp+48,yp+50);

	    _moveto(xp+8,yp);
	    _lineto(xp-0,yp+7);
	    _lineto(xp-7,yp+7);
	    _lineto(xp-7,yp+50);
	  }
	  break;
      case 5:/* Stecher fuer Seegereinstiche */
	  {
	    _moveto(xp,yp+50);
	    _lineto(xp,yp-20);
	    _lineto(xp+8,yp-20);
	    _lineto(xp+8,yp-16);
	    _lineto(xp+12,yp-14);
	    _lineto(xp+12,yp-10);
	    _lineto(xp+40,yp-4);
	    _lineto(xp+40,yp+50);
	  }
	  break;
      case 6:/* Abstechklinge HSS */
	  {
	    _moveto(xp,yp+50);
	    _lineto(xp,yp);
	    _lineto(xp+13,yp);
	    _lineto(xp+13,yp+50);
	    _moveto(xp,yp+17);
	    _lineto(xp+13,yp+17);
	  }
	  break;
      case 7:/* Gewindestahl innen rechts */
	  {
	    _moveto(xp-80,yp+20);
	    _lineto(xp-71,yp+14);
	    _lineto(xp-64,yp+14);
	    _lineto(xp-56,yp+10);
	    _lineto(xp+80,yp+10);

	    _moveto(xp-80,yp+20);
	    _lineto(xp-99,yp+14);
	    _lineto(xp-100,yp+14);
	    _lineto(xp-100,yp+0);
	    _lineto(xp-92,yp-4);
	    _lineto(xp-92,yp-6);
	    _lineto(xp+80,yp-6);
	  }
	  break;
      case 8:/* Innendrehstahl */
	  {
	    _moveto(xp-80,yp+20);
	    _lineto(xp-80,yp+8);
	    _lineto(xp-56,yp);	 /*y+1*/
	    _lineto(xp-56,yp+14);
	    _lineto(xp-80,yp+20);

	    _moveto(xp-56,yp+10);
	    _lineto(xp+40,yp+10);
	    _moveto(xp-72,yp+6);
	    _lineto(xp-72,yp-6);
	    _lineto(xp+40,yp-6);
	  }
   }
}
Beispiel #27
0
static void StringsUpdate (int xLeft, int yTop, int nScaling)
{
    STRING *pString;
    ROOT        *pRoot;
    int nString;
    int nColor;
    int nDustShift;
    int i;
    unsigned old_style;

    LT_GraphicsClearScreen ();

    for (pString = pStringsUpList, nString = 0;
             pString != NULL;
                 pString = pString -> pDown, nString++)
    {
        nColor     = NUMBER_TO_COLOR (nString);
        nDustShift = 2 * (nString % 6 + 1);

        _setcolor (nColor + 8);
        _rectangle (_GBORDER,
                    (pString -> xLeft   - xLeft) / nScaling,
                    (pString -> yTop    - yTop)  / nScaling,
                    (pString -> xRight  - xLeft) / nScaling,
                    (pString -> yBottom - yTop)  / nScaling);

        for (i = 0; i < pString -> nLetters; i++)
        {
            pRoot = cf::Roots::at(pString -> pLettersList [i]);
            _setcolor ((pRoot -> bType & ROOT_SPECIAL_LETTER) ? 15 : nColor);
            _rectangle (_GFILLINTERIOR,
                (pRoot -> xColumn - xLeft) / nScaling + nDustShift,
                (pRoot -> yRow    - yTop)  / nScaling,
                (pRoot -> xColumn + pRoot ->nWidth  - 1
                                        - xLeft) / nScaling + nDustShift,
                (pRoot -> yRow    + pRoot ->nHeight - 1
                                        - yTop)  / nScaling);
        }

        _setcolor (nColor + 8);

        for (i = 0; i < pString -> nDust; i++)
        {
            pRoot = cf::Roots::at(pString -> pDustList [i]);

            if (pRoot -> bType & ROOT_USED)
                continue;

            _rectangle (_GBORDER,
                (pRoot -> xColumn - xLeft) / nScaling + nDustShift,
                (pRoot -> yRow    - yTop)  / nScaling,
                (pRoot -> xColumn + pRoot ->nWidth - 1
                                        - xLeft) / nScaling + nDustShift,
                (pRoot -> yRow    + pRoot ->nHeight - 1
                                        - yTop)  / nScaling);
        }

        _setcolor (15);

        for (i = 0; i < pString -> nDust; i++)
        {
            pRoot = cf::Roots::at(pString -> pDustList [i]);

            if (pRoot -> bType & ROOT_USED)
                continue;

            _rectangle (_GBORDER,
                (pRoot -> xColumn - xLeft) / nScaling,
                (pRoot -> yRow    - yTop)  / nScaling,
                (pRoot -> xColumn + pRoot ->nWidth - 1
                                        - xLeft) / nScaling,
                (pRoot -> yRow    + pRoot ->nHeight - 1
                                        - yTop)  / nScaling);
        }

        _setcolor (nColor + 8);

        old_style = _getlinestyle ();
        _setlinestyle (0xcccc);

        _moveto ((pString -> xLeft  - xLeft) / nScaling,
                 (pString -> yMin   - yTop)  / nScaling);
        _lineto ((pString -> xRight - xLeft) / nScaling,
                 (pString -> yMin   - yTop)  / nScaling);

        _moveto ((pString -> xLeft  - xLeft) / nScaling,
                 (pString -> yMax   - yTop)  / nScaling);
        _lineto ((pString -> xRight - xLeft) / nScaling,
                 (pString -> yMax   - yTop)  / nScaling);
        _setlinestyle (old_style);

        _setcolor (12);
        _rectangle (_GBORDER,
                    (pString -> xLeft   - xLeft) / nScaling,
                    (pString -> yTop    - yTop)  / nScaling,
                    (pString -> xRight  - xLeft) / nScaling,
                    (pString -> yBottom - yTop)  / nScaling);

        _setcolor (15);
        _moveto ((pString -> xLeft         - xLeft) / nScaling,
                 (pString -> yMiddleTop    - yTop)  / nScaling);
        _lineto ((pString -> xRight        - xLeft) / nScaling,
                 (pString -> yMiddleTop    - yTop)  / nScaling);

        _moveto ((pString -> xLeft         - xLeft) / nScaling,
                 (pString -> yMiddleBottom - yTop)  / nScaling);
        _lineto ((pString -> xRight        - xLeft) / nScaling,
                 (pString -> yMiddleBottom - yTop)  / nScaling);
    }

    SeparatorsOutput (xLeft, yTop, nScaling);
}
Beispiel #28
0
static void CurrentStringUpdate (int xLeft, int yTop, int nScaling)
{
    ROOT *pRoot;
    int i;
    unsigned old_style;

    LT_GraphicsClearScreen ();

    for (i = 0; i < String.nLetters; i++)
    {
        pRoot = cf::Roots::at(String.pLettersList[i]);

        _setcolor ((pRoot -> bType & ROOT_SPECIAL_LETTER) ? 15 : 10);
        _rectangle (_GFILLINTERIOR,
            (pRoot -> xColumn                       - xLeft) / nScaling,
            (pRoot -> yRow                          - yTop)  / nScaling,
            (pRoot -> xColumn + pRoot ->nWidth  - 1 - xLeft) / nScaling,
            (pRoot -> yRow    + pRoot ->nHeight - 1 - yTop)  / nScaling);
    }

    _setcolor (10);

    for (i = 0; i < String.nDust; i++)
    {
        pRoot = cf::Roots::at(String.pDustList[i]);

        _rectangle (_GBORDER,
            (pRoot -> xColumn                        - xLeft) / nScaling - 1,
            (pRoot -> yRow                           - yTop)  / nScaling - 1,
            (pRoot -> xColumn + pRoot -> nWidth  - 1 - xLeft) / nScaling + 1,
            (pRoot -> yRow    + pRoot -> nHeight - 1 - yTop)  / nScaling + 1);
    }

    old_style = _getlinestyle ();
    _setlinestyle (0xcccc);

    _moveto ((String.xLeft  - xLeft) / nScaling,
             (String.yMin   - yTop)  / nScaling);
    _lineto ((String.xRight - xLeft) / nScaling,
             (String.yMin   - yTop)  / nScaling);

    _moveto ((String.xLeft  - xLeft) / nScaling,
             (String.yMax   - yTop)  / nScaling);
    _lineto ((String.xRight - xLeft) / nScaling,
             (String.yMax   - yTop)  / nScaling);
    _setlinestyle (old_style);

    _setcolor (12);
    _rectangle (_GBORDER,
                (String.xLeft   - xLeft) / nScaling,
                (String.yTop    - yTop)  / nScaling,
                (String.xRight  - xLeft) / nScaling,
                (String.yBottom - yTop)  / nScaling);

    _setcolor (15);
    _moveto ((String.xLeft         - xLeft) / nScaling,
             (String.yMiddleTop    - yTop)  / nScaling);
    _lineto ((String.xRight        - xLeft) / nScaling,
             (String.yMiddleTop    - yTop)  / nScaling);

    _moveto ((String.xLeft         - xLeft) / nScaling,
             (String.yMiddleBottom - yTop)  / nScaling);
    _lineto ((String.xRight        - xLeft) / nScaling,
             (String.yMiddleBottom - yTop)  / nScaling);
}
Beispiel #29
0
static void HystogramUpdate (int xLeft, int yTop, int nScaling)
{
    char szBuffer [32];
    int i;
    int nMaxValue;
    int iMaxColumn;
    struct textsettings ts;
    int nCharHeight;
	ROOT *pRoot;//Rom

    LT_GraphicsClearScreen ();

    nMaxValue  = 0;
    iMaxColumn = 0;

	/**/
    for (pRoot = cf::Roots::first(); pRoot < pAfterRoots; pRoot++)
    {
		if(pRoot->nBlock == pDebugBlock->nNumber)
		{
			int nColor = 8;

			if (pRoot -> bType & ROOT_LETTER)       nColor |= 1;
			if (pRoot -> bType & ROOT_RECOGNIZED)   nColor |= 2;
                        if (pRoot->isLayoutDust())              nColor |= 4;

			if (pRoot -> bType & ROOT_DEBUG)        nColor = 14;

			_setcolor (nColor);

			_rectangle (_GFILLINTERIOR,
				(pRoot -> xColumn - xLeft) / nScaling,
				(pRoot -> yRow    - yTop)  / nScaling,
				(pRoot -> xColumn + pRoot ->nWidth  - 1 - xLeft) / nScaling,
				(pRoot -> yRow    + pRoot ->nHeight - 1 - yTop)  / nScaling);
		}
    }
	/**/

    for (i = 0; i < nHystColumns; i++)
    {
        if (nMaxValue < pHystogram [i])
        {
            nMaxValue  = pHystogram [i];
            iMaxColumn = i;
        }
    }

    if (nMaxValue < 10)
        nMaxValue = 10;

    _gettextsettings (&ts);

    for (i = 0; i < nHystColumns; i++)
    {
        if (pHystogram [i] == 0)
        {

        }
        else
        {
            _setcolor (9);

            _rectangle (_GFILLINTERIOR,
                (i * VIEW_WIDTH / nHystColumns + VIEW_LEFT
                                                     - xLeft) / nScaling,
                (VIEW_BOTTOM - pHystogram [i] * VIEW_HEIGHT / nMaxValue
                                                     - yTop)  / nScaling,
                ((i + 1) * VIEW_WIDTH / nHystColumns + VIEW_LEFT
                                                     - xLeft) / nScaling,
                (VIEW_BOTTOM
                                                     - yTop)  / nScaling);
        }
    }

    _setcolor (12);

    _moveto (((xDebugVertLine - pDebugBlock -> Rect.xLeft)
                  * VIEW_WIDTH / nHystColumns
                        + VIEW_WIDTH / nHystColumns / 2
                        + VIEW_LEFT
                        - xLeft) / nScaling, 0);
    _lineto (((xDebugVertLine - pDebugBlock -> Rect.xLeft)
                  * VIEW_WIDTH / nHystColumns
                        + VIEW_WIDTH / nHystColumns / 2
                        + VIEW_LEFT
                        - xLeft) / nScaling, SCREEN_HEIGHT);

    _setcolor (15);
    _settextalign (_RIGHT, _TOP);
    nCharHeight = VIEW_HEIGHT / 10 / nScaling / 2;
    _setcharsize (nCharHeight, nCharHeight / 2);

    for (i = 0; i < nMaxValue - nMaxValue / 20; i += MAX (nMaxValue / 10, 1))
    {
        _moveto ((VIEW_LEFT                                 - xLeft)/ nScaling,
                 (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
        _lineto ((VIEW_RIGHT                                - xLeft)/ nScaling,
                 (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);

        if (i != 0)
        {
            sprintf (szBuffer, "%d\n", i);
            _grtext ((VIEW_LEFT - xLeft) / nScaling,
                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling,
                 szBuffer);
        }
    }

    sprintf (szBuffer, "%d\n", nMaxValue);
    _grtext ((VIEW_LEFT - xLeft) / nScaling,
             (VIEW_TOP  - yTop)  / nScaling,
             szBuffer);

    _rectangle (_GBORDER,
                (VIEW_LEFT   - xLeft) / nScaling,
                (VIEW_TOP    - yTop)  / nScaling,
                (VIEW_RIGHT  - xLeft) / nScaling,
                (VIEW_BOTTOM - yTop)  / nScaling);

    _setcharsize (ts.height, ts.width);
}