📄 npen0.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 */
/* */
/* NPEN0.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the PenSize function. */
/* */
/* 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"
/* Function PenSize sets the port's current pen size (thePort.pnSize) to
to the specified WIDTHX,HEIGHTY value, following X rules: any size from 1 on
up is acceptable as a width for a wide line; if either dimension is 0, then
the line is treated as a thin line. (X only supports circular pens, actually;
this is a superset.) Also, in virtual mode, pen widths > 0 are never allowed
to become less than 1.
This routine smart links non-dashed square pen lines.
This routine smart links square pen PolyLine. */
void PenSize(short WIDTHX, short HEIGHTY)
{
short grafErrValue; /* error value */
void mwLIT(void);
void mwPolyLine(void);
/* test for thin case, either size = 0 before scaling */
if ((WIDTHX == 0) || (HEIGHTY == 0))
{ /* set thin pen */
if (gFlags & gfRgnOpen) /* is region open? */
{ /* region open and thin pen requested, set pen to 1,1 */
WIDTHX = 1;
HEIGHTY = 1;
regPenFlags &= ~pnSizeFlg; /* make CloseRegion restore thin pen */
}
else
{
thePort->pnFlags &= ~pnSizeFlg; /* clear thick flag */
grafPort.pnFlags &= ~pnSizeFlg;
WIDTHX = 0; /* update port pen size to 0,0 */
HEIGHTY = 0;
goto PS080;
}
}
else
{
if (grafPort.portFlags & pfVirtual) /* test if virtual coordinates */
{ /* Virtual To Global size */
V2GSIZE(WIDTHX, HEIGHTY, &WIDTHX, &HEIGHTY);
}
/* test if height or width less than 1 */
if (WIDTHX < 1)
{
grafErrValue = c_PenSize + c_BadSize; /* bad size */
nuGrafErr(grafErrValue); /* report error */
WIDTHX = 1; /* width = 1 */
}
if (HEIGHTY < 1)
{
grafErrValue = c_PenSize + c_BadSize; /* bad size */
nuGrafErr(grafErrValue); /* report error */
HEIGHTY = 1; /* width = 1 */
}
}
thePort->pnFlags |= pnSizeFlg; /* set thick line flag */
grafPort.pnFlags |= pnSizeFlg;
regPenFlags |= pnSizeFlg; /* make CloseRegion leave pen alone */
PS080:
thePort->pnSize.X = WIDTHX; /* update user port */
thePort->pnSize.Y = HEIGHTY;
grafPort.pnSize.X = WIDTHX; /* update shadow port */
grafPort.pnSize.Y = HEIGHTY;
linePattIDV = (long) mwLIT; /* smart link non-dashed square lines */
SETLINESTYLE(grafPort.pnFlags); /* refresh current line style vector */
lineSqPolyIDV = (long) mwPolyLine; /* smart link square pen PolyLine */
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -