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

📄 view4.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          */
/*                                                                       */
/*      VIEW4.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the PortSize 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 PortSize changes the size of the current grafPort rectangle limits 
(portRect).  When changing the port size, the port origin-corner (upperleft/ 
lowerleft) remains at the same same position and the opposite corner is 
adjusted to the specifed width and height dimensions.

If the port origin is "upperleft" (+Y values increasing from top to bottom), 
the top left corner of the port remains at same position and the bottom right 
corner is adjusted accordingly.

If the port origin is "lowerleft" (+Y values increasing from bottom to top), 
the bottom left corner of the port remains at the same position and the top 
right corner is adjusted. */
void PortSize(int psWDX,  int psHTY)
{
	void mwGblCoord(void);
	void mwGblClip(metaPort *inpClpPort, rect *outClipR);
	short grafErrValue;
	long oldDY;
	long tempXY;
	rect tmpRect;

	if (psWDX <= 0)
	{	/* invalid width */
		psWDX = 1;
		grafErrValue = c_PortSize + c_BadSize;
		nuGrafErr(grafErrValue);
	}

	if (psHTY <= 0)
	{	/* invalid height */
		psHTY = 1;
		grafErrValue = c_PortSize + c_BadSize;
		nuGrafErr(grafErrValue);
	}

	oldDY = thePort-> portRect.Ymax - thePort->portRect.Ymin;
	tempXY = thePort->portRect.Xmin + psWDX;
	if (tempXY > 32767)
	{	/* overflow */
		grafErrValue = c_PortSize + c_OfloPt;
		nuGrafErr(grafErrValue);
	}
	else
	{
		thePort->portRect.Xmax = (short) tempXY;	/* update user port */
		grafPort.portRect.Xmax = (short) tempXY;	/* update shadow port */

		tempXY = thePort->portRect.Ymin + psHTY;
		if (tempXY > 32767)
		{	/* overflow */
			grafErrValue = c_PortSize + c_OfloPt;
			nuGrafErr(grafErrValue);
		}
		else
		{
			thePort->portRect.Ymax = (short) tempXY;	/* update user port */
			grafPort.portRect.Ymax = (short) tempXY;	/* update shadow port */
		}
	}

	if (!(thePort->portFlags & pfUpper))
	{	/* lower left origin */
		tempXY -= thePort->portRect.Ymin;
		oldDY -= tempXY;
		thePort->portOrgn.Y += (short) oldDY;
		grafPort.portOrgn.Y += (short) oldDY;
	}

	mwGblCoord();	/* update coordinate xform data */

	mwGblClip(thePort, &tmpRect);	/* convert to global and check port clip */
	ViewClip = tmpRect;

	return;
}

⌨️ 快捷键说明

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