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); }
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
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); }
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); }
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; } } }