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

📄 curs3.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          */
/*                                                                       */
/*      CURS3.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the mwInitShftCurs function.                  */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Robert G. Burrill, 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 "curs_ega.h"

/* Function mwInitShftCurs initializes 8 shift sequence cursor images
in the GRAFDATA "curBUFF" work area from the cursor image definitions
specified by curMASK and curIMAG. */

void mwInitShftCurs(image *srcMASK, image *srcIMAG)
{
	int curDataSize;	/* Size in bytes of a single cursor
						shift image (bytesPerRow*cursHeight) */
	int nextRow;
	byte priorMaskLSB;
	byte priorImagLSB;
	byte thisLSB;
	long dstBuff;	/* Index to cursor temporary storage buffer */
	int srcBuff;	/* Index to cursor source image */
	int i;
	int j;
	int iBit;

	cursImagBytesM1 = ((srcMASK->imWidth + 7) >> 3);
	nextRow = (int) (srcMASK->imBytes - cursImagBytesM1);
	cursImagHeightM1 = srcMASK->imHeight - 1;
					;
	/* Copy master cursor image to first shift image.     */
	dstBuff = 0;
	srcBuff = 0;
	for (i = (int) cursImagHeightM1; i >= 0; i--)
	{
		for (j = (int) cursImagBytesM1; j > 0; j--)	/* Store up to 4 bytes per row */
		{
			curBuffer[dstBuff++] = srcMASK->imData[srcBuff];
			curBuffer[dstBuff++] = srcIMAG->imData[srcBuff++];
		}
		curBuffer[dstBuff++] = 0;
		curBuffer[dstBuff++] = 0;
		srcBuff += nextRow;
	}

	curDataSize = (int) dstBuff;
	srcBuff = 0;
	for (iBit = 0; iBit < 7; iBit++)	/* build 7 shifted images */
	{
		for (i = (int) cursImagHeightM1; i >= 0; i--)
		{
			priorMaskLSB = 0;
			priorImagLSB = 0;
			for (j = (int) cursImagBytesM1; j >= 0; j--)
			{
				thisLSB = ((curBuffer[srcBuff] & 1) << 7);
				curBuffer[dstBuff++] = ((curBuffer[srcBuff++] >> 1) | priorMaskLSB);
				priorMaskLSB = thisLSB;
				thisLSB = ((curBuffer[srcBuff] & 1) << 7);
				curBuffer[dstBuff++] = ((curBuffer[srcBuff++] >> 1) | priorImagLSB);
				priorImagLSB = thisLSB;
			}
		}
	}

	dstBuff = (long) &curBuffer;
	for (iBit = 0; iBit < 8; iBit++)	/* store in active cursor buffer */
	{
		curActive[iBit][0] = dstBuff;
		curActive[iBit][1] = dstBuff;
		curActive[iBit][2] = dstBuff;
		curActive[iBit][3] = dstBuff;
		dstBuff += curDataSize;
	}

	oldCurFlags->pntr = 0;
	return;
}

⌨️ 快捷键说明

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