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

📄 zect5.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          */
/*                                                                       */
/*      ZECT5.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the InceptRect and INCEPT 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"

#define   TRUE	1
#define   FALSE 0


/* Local function INCEPT returns TRUE value if there is an intersection 
   between two rectangular otherwise it returns FALSE */
                          
int INCEPT ( short Min1 , short Max1, short Min2, short Max2 , rect * dstR , int test)
{
	
	if( (Min1 > Min2) || (Min2 > Max1) )
	{
		return(FALSE);		/* There is no interception  */
	}

	if(test == 0 )			/* X coordination points     */
	{
		dstR->Xmin = Min2;
		dstR->Xmax = Max2;
		if(Max2 > Max1) dstR->Xmax = Max1;	
	}
	
	else					/* Y coordination points     */
	{
		dstR->Ymin = Min2;
		dstR->Ymax = Max2;
		if(Max2 > Max1 ) dstR->Ymax = Max1;
	}

	return(TRUE);
}


/* Function INCEPTRECT calculates the rectangle DstR that is the intersection
   of two input source rectangles (R1 & R2), and RETURNs TRUE if they intersect
   or FALSE if they do not.  Rectangles that "touch" on the same line or point
   are considered as interesting.
   
   If the two source rectangles do not intersect, the destination is left
   unchanged.*/

int InceptRect ( rect * R1 , rect * R2 , rect * dstR )
{
	int value;
	rect tmpR;

/* Check for X intersection and if FALSE switch value       */	
	
	value = INCEPT(R1->Xmin,R1->Xmax,R2->Xmin,R2->Xmax, &tmpR ,0 );
	
/* Exchange position between two regtangulars   */
	if ( value == FALSE )
	{
		value = INCEPT(R2->Xmin,R2->Xmax,R1->Xmin,R1->Xmax, &tmpR ,0 );
		if ( value == FALSE ) return(value);	/* done if still false */
	}
		
		
/* Check for Y intersection and if FALSE switch value       */
	
	value = INCEPT(R1->Ymin,R1->Ymax,R2->Ymin,R2->Ymax, &tmpR ,1);

/* Exchange position between two regtangulars   */
	if ( value == FALSE )
	{
		value = INCEPT(R2->Ymin,R2->Ymax,R1->Ymin,R1->Ymax, &tmpR ,1);
	}
	

/* Return FALSE value if still Error existing, there is no intersection */
/* Also two regtangulars touch both X and Y coordination is FALSE       */
	if ( value == TRUE ) *dstR = tmpR;	/* set intersection rectangle */

	return(value);
}

⌨️ 快捷键说明

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