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

📄 hcvp6.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          */
/*                                                                       */
/*      HCVP6.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the mwPort2Gbl 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 mwPort2Gbl converts the rectangle in inpRect from the grafPort
pointed to by inpPort (even if its not the current port) into global
coordinates. */
void mwPort2Gbl(rect *inpRect, metaPort *inpPort, rect *dstRect)
{
	void mwVirtCoord(metaPort *inpPort);
	short saveXmin;
	short saveYmin;
	short saveFlags;

	*dstRect = *inpRect;

	if (inpPort->portFlags & pfVirtual)	/* virtual coord? */
	{	/* yes, have to precalculate some vars for the default routines
			including swaping portVirt.X-Ymin, flags to shadow port */
		mwVirtCoord(inpPort);
		saveXmin = grafPort.portVirt.Xmin;	/* save old values */
		saveYmin = grafPort.portVirt.Ymin;
		saveFlags = grafPort.portFlags;

		grafPort.portVirt.Xmin = inpPort->portVirt.Xmin;	/* set new values */
		grafPort.portVirt.Ymin = inpPort->portVirt.Ymin;
		grafPort.portFlags = inpPort->portFlags;

		inpPort->portU2GR(dstRect);	/* call user routine */

		/* precalc transformation variables back for current port */
		grafPort.portVirt.Xmin = saveXmin;
		grafPort.portVirt.Ymin = saveYmin;
		grafPort.portFlags = saveFlags;
		mwVirtCoord(&grafPort);
	}
	else
	{
		/* convert X */
		dstRect->Xmin = inpRect->Xmin - inpPort->portRect.Xmin + 
			inpPort->portOrgn.X;
		dstRect->Xmax = inpRect->Xmax - inpPort->portRect.Xmin + 
			inpPort->portOrgn.X;

		/* convert Y - lower left origin? */
        if (inpPort->portFlags & pfUpper)
		{	/* upper left */
			dstRect->Ymin = inpRect->Ymin - inpPort->portRect.Ymin + 
				inpPort->portOrgn.Y;
			dstRect->Ymax = inpRect->Ymax - inpPort->portRect.Ymin + 
				inpPort->portOrgn.Y;
		}
		else
		{	/* lower left */
			dstRect->Ymin = -inpRect->Ymax + inpPort->portRect.Ymax + 
				inpPort->portOrgn.Y;
			dstRect->Ymax = -inpRect->Ymin + inpPort->portRect.Ymax + 
				inpPort->portOrgn.Y;
		}
	}

	return;
}

⌨️ 快捷键说明

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