📄 reg08.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 */
/* */
/* REG08.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the SetRegion and RectRegion functions. */
/* */
/* 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 Procedure SetRegion() creates a region that describes a single
rectangle defined by two diagonal end-points, (X1,Y1) and (X2,Y2). If an
error occurs during RectRegion() (e.g. insufficient memory), a QueryError()
status is posted and a NULL pointer is returned. */
region *SetRegion( int X1, int Y1, int X2, int Y2 )
{
region *RectListToRegion(int NUMRECTS, rect *RECTLIST);
rect temRect;
int tem;
if(X1 > X2 )
{
tem = X1;
X1 = X2;
X2 = tem;
}
if(Y1 > Y2 )
{
tem = Y1;
Y1 = Y2;
Y2 = tem;
}
temRect.Xmin = X1;
temRect.Xmax = X2;
temRect.Ymin = Y1;
temRect.Ymax = Y2;
if(globalLevel > 0)
{
U2GR(temRect, &temRect, 0);
}
return((region *) RectListToRegion(1,&temRect));
}
/* Function RectRegion() creates a region that describes a single input
rectangle, SRCRECT. If an error occurs during RectRegion() (e.g.
insufficient memory), a QueryError() status is posted and a NULL pointer
is returned.
Memory for the new region definition is allocated dynamically using the
MetaWINDOW GrafAlloc() function. When finished using the region, the
program should call GrafFree() with the region pointer to release the
memory occupied by the region definition. */
region *RectRegion(rect *srcRECT)
{
region *RectListToRegion(int NUMRECTS, rect *RECTLIST);
rect temRect;
if(globalLevel > 0)
{
U2GR(*srcRECT, &temRect,0);
}
else
{
temRect = *srcRECT;
}
return((region *) RectListToRegion(1,&temRect));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -