📄 zect8.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 */
/* */
/* ZECT8.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the PT2RECT function. */
/* */
/* AUTHOR */
/* */
/* Giac Dinh, 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 PT2RECT RETURNs rectangle R with the smallest rectangle which
contains the two points PT1 & PT2.*/
void Pt2Rect ( point * PT1, point * PT2, rect * R )
{
short ErrValue;
long TemPt;
if ( PT2->X < PT1->X )
{
R->Xmin = PT2->X; /* Loading value */
R->Xmax = PT1->X;
}
else
{
R->Xmin = PT1->X; /* Loading value */
R->Xmax = PT2->X;
}
#ifdef ErrChecks
/* Error Checking to make sure that Xmin and Xmax are properly assigned */
if ( (R->Xmax - R->Xmin) > 32767) /* check for overflow condition */
{
/* Notify the Error with conditional flag */
ErrValue = c_Pt2Rect + c_OfloRect;
nuGrafErr(ErrValue);
TemPt = ((R->Xmax + R->Xmin) >> 1); /* get mid point */
R->Xmax = TemPt + 16383; /* assign Min and Max value */
R->Xmin = TemPt - 16383; /* for X coordination */
}
#endif
if ( PT2->Y < PT1->Y )
{
R->Ymin = PT2->Y; /* Loading value */
R->Ymax = PT1->Y;
}
else
{
R->Ymin = PT1->Y; /* Loading value */
R->Ymax = PT2->Y;
}
#ifdef ErrChecks
/* Error Checking to make sure that Xmin and Xmax are properly assigned */
if ( (R->Ymax - R->Ymin) > 32767) /* check for overflow condition */
{
/* Notify the Error with conditional flag */
ErrValue = c_Pt2Rect + c_OfloRect;
nuGrafErr(ErrValue);
TemPt = ((R->Ymax + R->Ymin) >> 1); /* get mid point */
R->Ymax = TemPt + 16383; /* assign Min and Max value */
R->Ymin = TemPt - 16383; /* for X coordination */
}
#endif
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -