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

📄 dpen5.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 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          */
/*                                                                       */
/*      DPEN5.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the DefineDash & DashStyle functions.         */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Robert G. Burrill, Accelerated Technology, Inc.                  */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*         BobB           6/15/99     Corrected reset of dash pointer    */
/*                                                                       */
/*************************************************************************/

#include "meta_wnd.h"
#include "metconst.h"    /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h"    /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"


/* Function DefineDash redefines the specified pen dashing index, in the range
1 to 7, to a user specified style. */

void DefineDash(int STYLE, dashRcd *LNSTYLE)
{
	short grafErrValue;	/* error value */
	int dashListSize;
	int i;
/* BobB 6/15/99 - added the following variable */
	byte *dashPtr;

	if ((STYLE < 1) || (STYLE > 7))
	{
		grafErrValue = c_DefineDa +  c_BadDash;
		nuGrafErr(grafErrValue);	/* report error */
		return;
	}

	if (LNSTYLE == 0)
	{	/* reset to the MetaWINDOW default for this dash #? */
/* BobB 6/15/99 - corrected the following lines for reset
		LNSTYLE->dashSize = DefDashTable[STYLE].dashSize;
		LNSTYLE->dashRsvd = DefDashTable[STYLE].dashRsvd;
		LNSTYLE->dashList = DefDashTable[STYLE].dashList;*/
		LNSTYLE = &DefDashTable[STYLE];
	}

	dashListSize = LNSTYLE->dashSize;
	if (dashListSize == 0)	/* verify that the new dashRcd is okay */
	{	
		grafErrValue = c_DefineDa +  c_BadDashCnt;
		nuGrafErr(grafErrValue);	/* report error */
		return;
	}

/* BobB 6/15/99 - added the following line to get the dash value */
	dashPtr = LNSTYLE->dashList;
	for (i = 0; i < dashListSize; i++)
	{
/* BobB 6/15/99 - corrected the following line for test value
		if (LNSTYLE->dashList != 0) */
		if (*dashPtr != 0)
		{	/* We have a valid dash sequence */
/* BobB 6/15/99 - corrected the following line for test value
			if (STYLE == grafPort.pnDashNdx) */	/* are we changing the current dash? */
			if (STYLE != grafPort.pnDashNdx)	/* are we changing the current dash? */
			{
				grafPort.pnDashCnt = 0;	/* yes, reset to the start of the new
					dash sequence in the shadow port */
				thePort->pnDashCnt = 0;	/* reset in the real port too */
			}

/* BobB 6/15/99 - corrected the following lines
			grafPort.pnDashRcd[i].dashSize = LNSTYLE->dashSize;
			grafPort.pnDashRcd[i].dashRsvd = LNSTYLE->dashRsvd;
			grafPort.pnDashRcd[i].dashList = LNSTYLE->dashList; */
			grafPort.pnDashRcd[STYLE].dashSize = LNSTYLE->dashSize;
			grafPort.pnDashRcd[STYLE].dashRsvd = LNSTYLE->dashRsvd;
			grafPort.pnDashRcd[STYLE].dashList = LNSTYLE->dashList;
			return;
		}
	}
	/*  must be 1 non-NULL pointer */
	grafErrValue = c_DefineDa +  c_BadDashCnt;
	nuGrafErr(grafErrValue);	/* report error */
	return;
}


/* Function DashStyle selects either an on-off or a double dash pen style. */

void DashStyle(int DASHSTYL)
{
	if (DASHSTYL == dashDouble)
	{
		grafPort.pnFlags |= pnDashStyle;
	}
	else
	{
		grafPort.pnFlags &= ~pnDashStyle;
	}

	thePort->pnFlags = grafPort.pnFlags;	/* set the flags in the real port */
	return;
}

⌨️ 快捷键说明

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