line1.c

来自「nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用」· C语言 代码 · 共 121 行

C
121
字号
/*************************************************************************/
/*                                                                       */
/*         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          */
/*                                                                       */
/*      LINE1.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the LINETO/LINEREL 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"


/* Function LINETO draws a "LineStyle" line from the current "pen" position
 to the specified (X,Y) screen coordinate using the predefined "RasterOp"
 write operation.  Line specifications which extend beyond the current
 viewport limits are automatically clipped appropriately.  The current "pen"
 position is updated to the specified (X,Y) screen coordinates. */

void LineTo( short valX, short valY)
{
	short previousX;
	short previousY;
	void (*lineExecPntr)();

	lineExecPntr = (void (*)()) lineExecIDV;

	grafPort.pnLoc.X = valX;	/* update shadow port */
	grafPort.pnLoc.Y = valY;

	thePort->pnLoc.X = valX;	/* update user port */
	thePort->pnLoc.Y = valY;

	previousX = LocX;			/* save previous point for this line */
	previousY = LocY;

	if (globalLevel > 0)
	{
		/* convert from user to global */
		U2GP(valX, valY, &LocX, &LocY, 1);
	}
	else
	{
		LocX = valX;			/* update global pen location */
		LocY = valY;
	}

	if (grafPort.pnLevel >= 0)	/* if pen hidden, we are done */
	{
		grafBlist.Xmin = previousX;	/* set up default blitRcd for this line */
		grafBlist.Ymin = previousY;
		grafBlist.Xmax = LocX;
		grafBlist.Ymax = LocY;
		grafBlist.skipStat = grafPort.pnCap;	/* draw with current end cap style */
		lineExecPntr(&grafBlit);	/* call the current line routine with the 
								default blitRcd */
	}
	return;
}


/* Function LINEREL draws a "LineStyle" line from the current "pen" position
a specified distance (DX,DY) using the predefined "RasterOp"
write operation.  Line specifications which extend beyond the current
viewport limits are automatically clipped appropriately.  The current "pen"
position is updated to the ending screen coordinates. */

void LineRel(short valDX, short valDY )
{
	
	grafPort.pnLoc.X += valDX;	/* Pickup and increment */
	grafPort.pnLoc.Y += valDY;

	LineTo(grafPort.pnLoc.X, grafPort.pnLoc.Y);

	return;
}

⌨️ 快捷键说明

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