📄 zect3.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 */
/* */
/* ZECT3.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the InsetRect 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 INSETRECT shrinks or expands the specified rectangle 'R'.
The left and right sides are moved toward the center by the amount specifed
by DX; the top and bottom are moved to the center by the amount specified
DY. If DX or DY are negative the appropriate pair of sides are moved
outward instead of inward. The effect of INSETRECT is to alter the size
of rectangle 'R' by R*DX horizontally and 2*DY vertically, with the rectangle
center remaining centered at the same position.*/
void InsetRect ( rect * R , short dltX , short dltY )
{
short Ctr;
short ErrValue;
/* Restore the Value of X and Y with proper size */
R->Xmin = R->Xmin + dltX ;
R->Xmax = R->Xmax - dltX ;
R->Ymin = R->Ymin + dltY ;
R->Ymax = R->Ymax - dltY ;
/* Checking Error for X coordination */
#ifdef ErrChecks
if ( (R->Xmax - R->Xmin) > 32767 )
{
ErrValue = c_InsetRec + c_OfloRect;
nuGrafErr(ErrValue);
Ctr = (R->Xmin + R->Xmax) >> 1;
R->Xmin = Ctr - 16383; /* Resize for both Min */
R->Xmax = Ctr + 16383; /* and Max value */
}
if ( R->Xmin > R->Xmax )
{
ErrValue = c_InsetRec + c_NullRect;
nuGrafErr(ErrValue);
Ctr = (R->Xmin + R->Xmax) >> 1;
R->Xmin = Ctr ; /* Resize for both Min */
R->Xmax = Ctr ; /* and Max value */
}
#endif
/* Checking Error for Y coordination */
#ifdef ErrChecks
if ( (R->Ymax - R->Ymin) > 32767 )
{
ErrValue = c_InsetRec + c_OfloRect;
nuGrafErr(ErrValue);
Ctr = (R->Ymin + R->Ymax) >> 1;
R->Ymin = Ctr - 16383; /* Resize for both Min */
R->Ymax = Ctr + 16383; /* and Max value */
}
if ( R->Ymin > R->Ymax )
{
ErrValue = c_InsetRec + c_NullRect;
nuGrafErr(ErrValue);
Ctr = (R->Ymin + R->Ymax) >> 1;
R->Ymin = Ctr ; /* Resize for both Min */
R->Ymax = Ctr ; /* and Max value */
}
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -