📄 poly4.c
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1997 - 1999 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* POLY4.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the FillPoly & __mwFP functions. */
/* */
/* AUTHOR */
/* */
/* Robert G. Burrill, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* */
/*************************************************************************/
#include "meta_wnd.h"
#include "metconst.h" /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h" /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
#include "metmacs3.h"
#include "poly_4.h"
void __mwFP(void);
/* Function FillPoly fills the specified polygon(s) using one of the predefined
fill patterns specified by fpPATINDEX (0-31) in rasterOp "replace" transfer mode. */
void FillPoly(int POLYCNT, polyHead *POLYHDR, point *POLYPTS, int fpPATINDEX)
{
short grafErrValue; /* error value */
if (grafPort.pnLevel < 0) return;/* nothing to do */
if (POLYCNT <= 0) return;/* skip if no polygons */
lclPOLYCNT = POLYCNT; /* copy the input locally */
lclPOLYHDR = POLYHDR;
lclPOLYPTS = POLYPTS;
if (fpPATINDEX > 31)
{
grafErrValue = c_FillPoly + c_BadPatt;
nuGrafErr(grafErrValue); /* report error */
fpPATINDEX = 1; /* default pattern */
}
grafBlit.blitRop = 0; /* set up default blit record */
grafBlit.blitPat = fpPATINDEX;
__mwFP(); /* fill the polygon(s) */
grafBlit.blitRop = grafPort.pnMode; /* restore blit record */
grafBlit.blitPat = grafPort.pnPat;
return;
}
/* Function mwFP fills the polygon described by lclPOLYPTS, lclPOLYHDR,
and lclPOLYCNT. pnLevel lclPOLYCNT and must already have been checked
for being >= 0. */
void __mwFP(void)
{
rect usrC; /* clip rectangle in user coordinates */
int polyHeadSize; /* size of polygon header */
int ptCnt; /* number of points in the polygon */
point *bgnPtAds;
void FillPolygon(point *pointsparm, unsigned int npointsparm,
int modeparm, int shape);
/* set up the clip rectangle in user coordinates */
usrC = ViewClip;
if (globalLevel > 0) /* already in global? */
{
G2UR(usrC, &usrC); /* convert from global to user */
}
polyHeadSize = sizeof(polyHead);
for (; lclPOLYCNT > 0; lclPOLYCNT--)
{
/* perform trivial clip rejection */
if ((lclPOLYHDR->polyRect.Xmin <= usrC.Xmax) &&
(lclPOLYHDR->polyRect.Xmax > usrC.Xmin) &&
(lclPOLYHDR->polyRect.Ymin <= usrC.Ymax) &&
(lclPOLYHDR->polyRect.Ymax > usrC.Ymin))
{
ptCnt = lclPOLYHDR->polyEnd - lclPOLYHDR->polyBgn;
if (ptCnt <= 0) break;
ptCnt++;
bgnPtAds = &lclPOLYPTS[lclPOLYHDR->polyBgn]; /* point to
the start vertex for this polygon */
/* draw the current polygon */
FillPolygon(bgnPtAds, ptCnt, coordModeOrigin, cmplx);
}
lclPOLYHDR = lclPOLYHDR + polyHeadSize;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -