⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strk0.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 C
📖 第 1 页 / 共 2 页
字号:
				{
					grafBlist.skipStat = NoSkip;
				}
			
				ScaleNode(temp.X, temp.Y, &temp);

			/* Factor in Pen locations  */		
				if(grafPort.txFace & faceMirrorX) temp.X = -temp.X;
				if(!(grafPort.txFace & faceMirrorY)) temp.Y = -temp.Y;
				temp.X += baseX;
				temp.Y += baseY;

				if((mov_draw == -1) && (grafPort.pnLevel >= 0))
				{	/* Draw it */
					grafBlist.Xmin = lastX;
					grafBlist.Ymin = lastY;
					grafBlist.Xmax = temp.X;
					grafBlist.Ymax = temp.Y;
				
					lineExecPntr(&grafBlit);

				}

				lastX = temp.X;	/* set up next vector */
				lastY = temp.Y;
				mov_draw = -1 ;
			}
		}
	}

/* Done with the all the characters */
	grafBlit.blitRop = grafPort.pnMode;
	
	if( globalLevel > 0)
	{
		G2UP(LocX, LocY, &grafPort.pnLoc.X, &grafPort.pnLoc.Y);
	}
	else
	{
		grafPort.pnLoc.X = LocX;
		grafPort.pnLoc.Y = LocY;
	}

	thePort->pnLoc.X = grafPort.pnLoc.X;
	thePort->pnLoc.Y = grafPort.pnLoc.Y;

	return;

}


/* Function ScaleNode scales for unit size (sizeX/fxSpac) & (sizeY/leading):

	x' = x*(sizeX/fxSpac)*cosA + y*(sizeY/leading)*((sinA*resX)/resY));
	y' = y*(sizeY/leading)*cosA - x*(sizeX/fxWidth)*((sinA*resY)/resX));

   let:  (calculated in mwSTRKINI)
	qDxx = (sizeX/fxSpac)*cosA;
	qDxy = (sizeY/leading)*((sinA*resX)/resY));
	qDyy = (sizeY/leading)*cosA;
	qDyx = (sizeX/fxWidth)*((sinA*resY)/resX));

   then:
	x' = x*qDxx + y*qDxy;
	y' = y*qDyy - x*qDyx;  */

#ifdef FIXPOINT
void ScaleNode(short nodeX, short nodeY, point *scaledPoint)
{
	long tempSPX, tempSPY;
	long snX, snY;
	long bmResX, bmResY;
	long bmSinSlant, bmCosSlant;
	long slantSF = 0x7FFF0000;
	long roundValue = 0x00008000;

	snX = nodeX << 16;
	snY = nodeY << 16;
	bmResX = grafPort.portMap->pixResX << 16;
	bmResY = grafPort.portMap->pixResY << 16;

	if(StrokeFlags & slant )
	{
		bmSinSlant = Fix_div(sinSlant,slantSF);
		if(StrokeFlags & signSlantSin) 
			bmSinSlant = -bmSinSlant;
		bmCosSlant = Fix_div(cosSlant,slantSF);
		if(StrokeFlags & signSlantCos) bmCosSlant = - bmCosSlant;
		snX = (snX - Fix_mul(Fix_mul(snY,bmSinSlant),Fix_div(bmResX,bmResY)));
		snY = Fix_mul(snY,bmCosSlant);
	}
	
	if(StrokeFlags & (path | angle))
	{
		tempSPX = Fix_mul(snX,qDxx) + Fix_mul(snY,qDxy);
		tempSPY = (Fix_mul(snY,qDyy) - Fix_mul(snX,qDyx));
	}
	else
	{
		tempSPX = Fix_mul(snX,qDxx);
		tempSPY = Fix_mul(snY,qDyy);
	}

	if ((tempSPX >> 16) >= 0)
	{	/* round up */
		scaledPoint->X = (short) ((tempSPX + roundValue) >> 16);
	}
	else
	{	/* round down */
		scaledPoint->X = (short) ((tempSPX - roundValue) >> 16);
	}

	if ((tempSPY >> 16) >= 0)
	{	/* round up */
		scaledPoint->Y = (short) ((tempSPY + roundValue) >> 16);
	}
	else
	{	/* round down */
		scaledPoint->Y = (short) ((tempSPY - roundValue) >> 16);
	}

	return;
}

#else /* floating-point math */
void ScaleNode(short nodeX, short nodeY, point *scaledPoint)
{
	float tempSPX, tempSPY;
	float snX, snY;
	float bmResX, bmResY;
	float bmSinSlant, bmCosSlant;
	float slantSF = 32767;
	float roundValue = 0.5;

	snX = nodeX;
	snY = nodeY;
	bmResX = grafPort.portMap->pixResX;
	bmResY = grafPort.portMap->pixResY;

	if(StrokeFlags & slant )
	{
		bmSinSlant = (float) sinSlant / slantSF;

/* BobB 1/6/99 - Added the following lines to correct sign */
		if(StrokeFlags & signSlantSin) bmSinSlant = - bmSinSlant;
		bmCosSlant = (float) cosSlant / slantSF;

/* BobB 1/6/99 - Added the following lines to correct sign */
		if(StrokeFlags & signSlantCos) bmCosSlant = - bmCosSlant;
		snX -= (snY * bmSinSlant * (bmResX / bmResY));
		snY *= bmCosSlant;
	}
	
	if(StrokeFlags & (path | angle))
	{
		tempSPX = snX * qDxx + snY * qDxy;
		tempSPY = snY * qDyy - snX * qDyx;
	}
	else
	{
		tempSPX = snX * qDxx;
		tempSPY = snY * qDyy;
	}

	if (tempSPX >= 0)
	{	/* round up */
		scaledPoint->X = (short) (tempSPX + roundValue);
	}
	else
	{	/* round down */
		scaledPoint->X = (short) (tempSPX - roundValue);
	}

	if (tempSPY >= 0)
	{	/* round up */
		scaledPoint->Y = (short) (tempSPY + roundValue);
	}
	else
	{	/* round down */
		scaledPoint->Y = (short) (tempSPY - roundValue);
	}

	return;
}
#endif
	

/* Function ScalePath scales for unit size (sizeX/fxSpac) & (sizeY/leading):

	x' = x*(sizeX/fxSpac)*cosA + y*(sizeY/leading)*((sinA*resX)/resY));
	y' = y*(sizeY/leading)*cosA - x*(sizeX/fxWidth)*((sinA*resY)/resX));

   let:  (calculated in mwSTRKINI)
	qPxx = (sizeX/fxSpac)*cosA;
	qPxy = (sizeY/leading)*((sinA*resX)/resY));
	qPyy = (sizeY/leading)*cosA;
	qPyx = (sizeX/fxWidth)*((sinA*resY)/resX));

   then:
	x' = x*qPxx + y*qPxy;
	y' = y*qPyy - x*qPyx;  */

#ifdef FIXPOINT
void ScalePath (short nodeX, short nodeY, point *scaledPoint)
{
	long tempSPX, tempSPY;
	long snX, snY;
	long roundValue = 0x00008000;

	snX = nodeX << 16;
	snY = nodeY << 16;
	
	tempSPX = Fix_mul(snX,qPxx) + Fix_mul(snY,qPxy);
	tempSPY = Fix_mul(snY,qPyy) - Fix_mul(snX,qPyx);

	if (tempSPX >= 0)
	{	/* round up */
		scaledPoint->X = (short) ((tempSPX + roundValue) >> 16);
	}
	else
	{	/* round down */
		scaledPoint->X = (short) ((tempSPX - roundValue) >> 16);
	}

	if (tempSPY >= 0)
	{	/* round up */
		scaledPoint->Y = (short) ((tempSPY + roundValue) >> 16);
	}
	else
	{	/* round down */
		scaledPoint->Y = (short) ((tempSPY - roundValue) >> 16);
	}

	return;
}

#else /* floating-point math */
void ScalePath (short nodeX, short nodeY, point *scaledPoint)
{
	float tempSPX, tempSPY;
	float snX, snY;
	float roundValue = 0.5;

	snX = nodeX;
	snY = nodeY;
	tempSPX = (snX * qPxx + snY * qPxy);
	tempSPY = (snY * qPyy - snX * qPyx);

	if (tempSPX >= 0)
	{	/* round up */
		scaledPoint->X = (short) (tempSPX + roundValue);
	}
	else
	{	/* round down */
		scaledPoint->X = (short) (tempSPX - roundValue);
	}

	if (tempSPY >= 0)
	{	/* round up */
		scaledPoint->Y = (short) (tempSPY + roundValue);
	}
	else
	{	/* round down */
		scaledPoint->Y = (short) (tempSPY - roundValue);
	}

	return;
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -