📄 dpen6.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 */
/* */
/* DPEN6.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the PenOffset 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"
/* Function PenOffset defines the starting position within a dash sequence at
which to begin drawing the current dashed line style. DASHOFFSET specifies
the dash sequence starting position, specified in units of horizontal pixels. */
void PenOffset(int DSHOFFSET)
{
short grafErrValue; /* error value */
int dashListSize;
int currDashRcd;
int i;
if ((grafPort.pnDash < 1) || (grafPort.pnDash > 7))
{
grafErrValue = c_PenOffse + c_BadDash;
nuGrafErr(grafErrValue); /* report error */
return;
}
currDashRcd = grafPort.pnDash; /* current dashRcd # */
dashListSize = grafPort.pnDashRcd[currDashRcd].dashSize;
if (dashListSize == 0) /* verify that the new dashRcd is okay */
{
grafErrValue = c_PenOffse + c_BadDashCnt;
nuGrafErr(grafErrValue); /* report error */
return;
}
grafPort.pnFlags &= ~pnDashState; /* set off because it gets flipped the
first time */
while (1) /* note: this will be an infinite loop if all dash counts are 0.
That is guarded against in DefineDash; any user who sets up dashing
in the port themselves will just have to worry about it themselves! */
{
for (i = 0; i < dashListSize; i++)
{
grafPort.pnFlags ^= pnDashState; /* flip the dash state */
DSHOFFSET -= grafPort.pnDashRcd[currDashRcd].dashList[i];
if (DSHOFFSET < 0) goto DP150; /* count down dash sizes */
}
}
DP150:
grafPort.pnDashCnt = -DSHOFFSET; /* store the adjusted count remaining
in the shadow port */
grafPort.pnDashNdx = i; /* ditto for the dash # */
thePort->pnDashCnt = grafPort.pnDashCnt; /* set the real port, too */
thePort->pnDashNdx = grafPort.pnDashNdx;
thePort->pnFlags = grafPort.pnFlags;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -