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

📄 arcs8.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 C
📖 第 1 页 / 共 2 页
字号:
			vt, gXmin, gYmin,    NA,  endY, down,    0,
			ln,  endX,  endY, aXmax, aYmax, down, tEnd,
/* type14 */ln, aXmax, aYmax,  bgnX,  bgnY, down,    0,
			vt, gXmin,  bgnY,    NA, gYmax, down,    0,
			vt, gXmax, gYmin,    NA, gYmax,   up,    0,
			vt, gXmin, gYmin,    NA,  endY, down,    0,
			ln,  endX,  endY, aXmax, aYmax,   up, tEnd,
/* type15 */ln, aXmax, aYmax,  bgnX,  bgnY, down,    0,
			vt, gXmax,  endY,    NA,  bgnY,   up,    0,
			ln,  endX,  endY, aXmax, aYmax,   up, tEnd,
			NA,    NA,    NA,    NA,    NA,   NA,   NA,
			NA,    NA,    NA,    NA,    NA,   NA,   NA,
/* type16 */ln, aXmax, aYmax,  bgnX,  bgnY, down,    0,
			vt, gXmax,  endY,    NA,  bgnY,   up,    0,
			ln,  endX,  endY, aXmax, aYmax, down, tEnd,
			NA,    NA,    NA,    NA,    NA,   NA,   NA,
			NA,    NA,    NA,    NA,    NA,   NA,   NA,
/* type17 */ln, aXmax, aYmax,  bgnX,  bgnY, down,    0,
			vt, gXmax, gYmin,    NA,  bgnY,   up,    0,
			vt, gXmin, gYmin,    NA,  endY, down,    0,
			ln,  endX,  endY, aXmax, aYmax, down, tEnd,
			NA,    NA,    NA,    NA,    NA,   NA,   NA,
/* type18 */ln, aXmax, aYmax,  bgnX,  bgnY, down,    0,
			vt, gXmax, gYmin,    NA,  bgnY,   up,    0,
			vt, gXmin, gYmin,    NA,  endY, down,    0,
			ln,  endX,  endY, aXmax, aYmax,   up, tEnd,
			NA,    NA,    NA,    NA,    NA,   NA,   NA,
/* type19 */ln, aXmax, aYmax,  bgnX,  bgnY, down,    0,
			vt, gXmax, gYmin,    NA,  bgnY,   up,    0,
			vt, gXmin, gYmin,    NA, gYmax, down,    0,
			vt, gXmax,  endY,    NA, gYmax,   up,    0,
			ln,  endX,  endY, aXmax, aYmax,   up, tEnd};

/* The following table defines where top quadrant arcs are drawn
for each arc type (1=draw, 0=no draw). */
	byte TOP_TBL[20] = {1,1,1,1,1, 1,1,1,1,1, 0,0,1,1,1, 0,1,1,1,1};

/* The following table defines where bottom quadrant arcs are drawn
for each arc type (1=draw, 0=no draw). */
	byte BOT_TBL[20] = {0,0,1,1,1, 0,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1};

	for (i = 0; i < 12; i++) qaEdgeBuffer[i].NextEdge = 0;	/* GET is initially empty */
	if (grafPort.pnLevel < 0) return;	/* nothing to do */

	/* save off blitrecord settings we intend to change */
	savRop = grafBlit.blitRop;
	savPat = grafBlit.blitPat;

	/* set up angles */
	if (arcAngle == 0) return;
	if (arcAngle < 0)
	{	/* arc angle less than 0; fixup begin angle and make positive */
		if (arcAngle < -3600) arcAngle = -3600;
		bgnAngle = bgnAngle + arcAngle;
		arcAngle = -arcAngle;
	}

	if (arcAngle > 3600) arcAngle = 3600;	/* limit to +360.0 */

	bgnAngle = ChkAngle(bgnAngle);	/* insure ( 0 <= bgnANGLE < 3600 ) */

	endAngle = bgnAngle + arcAngle;
	bgnQuad = bgnAngle / 900;
	endQuad = endAngle / 900;
	arcType = endQuad + (bgnQuad << 2);

	gR = *ovalR;	/* get rectangle */
	globalLevel--;	/* check and keep global from now on */

/* BobB 5/8/98 corrected the following line for global level
	if (globalLevel > 0) */
	if (globalLevel >= 0)
	{
		/* convert from user to global */
		U2GR(gR, &gR, 0);
	}

	xRadius = ((gR.Xmax - gR.Xmin) >> 1);
	yRadius = ((gR.Ymax - gR.Ymin) >> 1);
	if ((xRadius == 0) || (yRadius == 0))
	{
		globalLevel++;
		return;
	}
	if ((xRadius < 0) || (yRadius < 0))
	{
		grafErrValue = c_FillArc +  c_NullRect;	/* bad rectangle */
		nuGrafErr(grafErrValue);	/* report error */
		globalLevel++;
		return;
	}

	/* set the blitrecord rasterop and pattern to the requested */
	grafBlit.blitRop = RASOP;
	grafBlit.blitPat = PATT;
					
	cR.Xmin = gR.Xmin + xRadius;	/* compute center point */
	cR.Ymin = gR.Ymin + yRadius;
	cR.Xmax = gR.Xmax - xRadius;
	cR.Ymax = gR.Ymax - yRadius;

	OvalPt(&gR, bgnAngle, &bgnPt);	/* point of intersection for begin angle */
	OvalPt(&gR, endAngle, &endPt);	/* point of intersection for end angle */

	GETPtr = &qaEdgeBuffer[0];
	newEdge = GETPtr;

	/* set up the top arcs first */
	if (TOP_TBL[arcType] != 0)	/* Draw or no draw top arcs? */
	{	/* draw */
		newEdge->countNumber = 0;	/* show as arc entry */
		mwSTQA(newEdge, xRadius, yRadius, cR.Xmin, cR.Ymin, -1, -1);
		newEdge++;	/* point to next table entry */

		mwSTQA(newEdge, xRadius, yRadius, cR.Xmax, cR.Ymin, 1, 1);
		newEdge->countNumber = 0;	/* show as arc entry */
		AddToGETYXSorted(newEdge);	/* insert the new edge in GET, YX sorted */
		newEdge++;	/* point to next table entry */

		/* if the top arcs are flat, we do not need the bottom arcs */
		if (qaEdgeBuffer[0].Count == 1) goto AF500;
	}

	/* now add the bottom arcs, with the top points trimmed off to avoid
	overlap problems */
	if (BOT_TBL[arcType] != 0)	/* Draw or no draw bottom arcs? */
	{	/* draw */
		mwSBQA(newEdge, xRadius, yRadius, cR.Xmin, (cR.Ymax -1), 1, -1);
		newEdge->countNumber = 0;	/* show as arc entry */
		newEdge->StepVector(newEdge);	/* advance Y by 1 (skip first point) */
		newEdge->Count--;	/* skip the bottommost point */
		newEdge->StartY++;	/* shift down 1 */
		if (newEdge != &qaEdgeBuffer[0])	/* skip add if first one */
		{
			AddToGETYXSorted(newEdge);	/* insert the new edge in GET, YX sorted */
		}
		newEdge++;	/* point to next table entry */

		mwSBQA(newEdge, xRadius, yRadius, cR.Xmax, (cR.Ymax -1), -1, 1);
		newEdge->countNumber = 0;	/* show as arc entry */
		newEdge->StepVector(newEdge);	/* advance Y by 1 (skip first point) */
		newEdge->Count--;	/* skip the bottommost point */
		newEdge->StartY++;	/* shift down 1 */
		AddToGETYXSorted(newEdge);	/* insert the new edge in GET, YX sorted */
		newEdge++;	/* point to next table entry */
	}

AF500:
	/* Ready to process line insertions */

	/* set up point table */
	pointTbl[0] = cR.Xmin;
	pointTbl[1] = cR.Ymin;
	pointTbl[2] = cR.Xmax;
	pointTbl[3] = cR.Ymax;
	pointTbl[4] = gR.Xmin;
	pointTbl[5] = gR.Ymin;
	pointTbl[6] = gR.Xmax;
	pointTbl[7] = gR.Ymax;
	pointTbl[8] = bgnPt.X;
	pointTbl[9] = bgnPt.Y;
	pointTbl[10] = endPt.X;
	pointTbl[11] = endPt.Y;

	for (typePtr = 0; typePtr < 5; typePtr++)
	{
		if (typeTbl[arcType][typePtr][aeType] == vt)	/* vertical or line edge entry? */
		{	/* Enter vertical edge */
			lineHeight = (pointTbl[typeTbl[arcType][typePtr][aeEndY]] -
				pointTbl[typeTbl[arcType][typePtr][aeBgnY]]);
			if (lineHeight > 0)	/* skip if 0 */
			{	/* insert end line edge */
				mwSV((Vedge *)newEdge, pointTbl[typeTbl[arcType][typePtr][aeBgnX]],
					pointTbl[typeTbl[arcType][typePtr][aeBgnY]], lineHeight,
					typeTbl[arcType][typePtr][aeDir]);
				newEdge->countNumber = 1;
				AddToGETYXSorted(newEdge);	/* insert the new edge in GET, YX sorted */
				newEdge++;
			}
		}
		else
		{	/* Enter line edge */
			/* skip if bgnY == endY */
			if (pointTbl[typeTbl[arcType][typePtr][aeBgnY]] !=
				pointTbl[typeTbl[arcType][typePtr][aeEndY]])
			{	/* insert the line edge */
				mwSLE((lineEdgeV *)newEdge, pointTbl[typeTbl[arcType][typePtr][aeBgnX]],
					pointTbl[typeTbl[arcType][typePtr][aeBgnY]],
					pointTbl[typeTbl[arcType][typePtr][aeEndX]],
					pointTbl[typeTbl[arcType][typePtr][aeEndY]],
					typeTbl[arcType][typePtr][aeDir]);
				newEdge->countNumber = 1;
				AddToGETYXSorted(newEdge);	/* insert the new edge in GET, YX sorted */
				newEdge++;
			}
		}

		if (typeTbl[arcType][typePtr][aeEnd] == tEnd) break;
	}

	/* draw the arc and done! */
	mwScanGET((void **)&GETPtr, (blitRcd *)&rFillRcd[0], fillRcdSize, cmplx, -1, 0);
	globalLevel++;
	/* restore the blitrecord rasterop and pattern */
	grafBlit.blitRop = savRop;
	grafBlit.blitPat = savPat;

	return;
}

⌨️ 快捷键说明

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