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

📄 setp0.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.                                     */
/*                                                                       */
/*************************************************************************/

/*************************************************************************/
/*                                                                       */
/* FLLE NAME                                            VERSION          */
/*                                                                       */
/*      SETP0.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the mwSPA function.	                         */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Giac Dinh, Accelerated Technology, Inc.                          */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*         BobB           12/29/98     Corrected set pixel               */
/*         BobB           5/14/99      Corrected pColor type             */
/*                                                                       */
/*************************************************************************/

#include "meta_wnd.h"
#include "metconst.h"    /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h"    /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
#include "metmacs3.h"
#include "regclipv.h"

/* Module SETP0 is a special case optimization for SetPixel, 8-bit-per-pixel
   memory destination, rectangular and/or region clipping with color
   translation.  */
/*       *******************************************
         * Only patterns 0 and 1 are handled here, *
         * and only raster ops 0 and 16!!!!        *
         *******************************************

blitCnt is ignored; it's assumed to be 1.
*/
void mwSPA(blitRcd *setpRec )
{

	void DrawRectEntry_setp(blitRcd *drwPRec);
	int Set_Up_Clip(blitRcd *clipBlit, rect *cRect, int blitMayOverlap,
				int isLine);
	int Fill_Clip_Region(blitRcd *fcRec, rect *dRectect);
	void nuResume(grafMap *argGRAFMAP);
	point *drawPt;	/* Pointer to point to draw */
	
	int blitMayOverlap = 0;	/* Set false */
	int isLine = 0;	/* Set false */

	/* set up the rectangular/region clip info */
	if (Set_Up_Clip(setpRec, &cRect, blitMayOverlap, isLine)) return;

	drawPt = (point *) setpRec->blitList;	/* set up pointer */
	dRect.Xmin = drawPt->X;
	dRect.Ymin = drawPt->Y;
	M_PAUSE(setpRec->blitDmap);	/* lock grafMap */

	/* do we need to worry about clipping at all*/
	if (clipToRectFlag == 0)
	{	/* no--valid coordinates are guaranteed at a higher level */
		DrawRectEntry_setp(setpRec);	/* draw the point */
	}
	else
	{	/* yes first check trivial reject */
		if ((dRect.Xmin >= cRect.Xmin) && (dRect.Ymin >= cRect.Ymin) &&
			(dRect.Xmin < cRect.Xmax) && (dRect.Ymin < cRect.Ymax))
		{	/* it passes so far - do we need to worry about region clipping? */
			if (clipToRegionFlag == 0)
			{	/* no, draw the point */
				DrawRectEntry_setp(setpRec);
			}
			else
			{	/* yes, clip to the region and draw */
				dRect.Xmax = dRect.Xmin + 1;
				dRect.Ymax = dRect.Ymin + 1;
				FillDrawer = &DrawRectEntry_setp;
				Fill_Clip_Region(setpRec, &dRect);
			}
		}
	}

	nuResume(setpRec->blitDmap);
	return;
}

void DrawRectEntry_setp(blitRcd *drwPRec)
{
	grafMap *drwGmap;
	long *rowTable;
	byte *bytePtr;
/* BobB 5/14/99 - corrected pColor type
	short pColor; */
	byte pColor;

	drwGmap = drwPRec->blitDmap;	/* get grafMap */
	if ((dRect.Ymin < drwGmap->mapWinYmin[0]) ||	/* below window #0? */
		(dRect.Ymin > drwGmap->mapWinYmax[0]))	/* above window #0? */
	{	/* yes, map in bank */
		drwGmap->mapBankMgr(drwGmap, dRect.Ymin, -1, 0);
	}
	rowTable = (long *) drwGmap->mapTable[0];	/* point to row table */
	rowTable = rowTable + dRect.Ymin;	/* look up the starting row */
	/* point to pixel */
	bytePtr = (byte *) ((*rowTable) + dRect.Xmin);
	if (drwPRec->blitPat == 0)	/* pattern 0? */
	{	/* yes, use background color */
		if (drwPRec->blitRop & 0x10) return;	/* done if transparent */

/* BobB 5/14/99 - corrected pColor type
		pColor = (short) drwPRec->blitBack; */
		pColor = (byte) drwPRec->blitBack;
	}
	else
	{	/* no, use foreground color */
/* BobB 5/14/99 - corrected pColor type
		pColor = (short) drwPRec->blitFore; */
		pColor = (byte) drwPRec->blitFore;
	}

/* BobB 12/29/98 - Corrected the following line for set pixel
	*bytePtr = pColor & sMapMask; */	/* draw the pixel */
	*bytePtr = pColor;	/* draw the pixel */

	return;
}

⌨️ 快捷键说明

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