📄 kvir9.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 */
/* */
/* KVIR9.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the ReadPalette & WritePalette functions. */
/* */
/* 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 "devc.h"
/* Function WritePalette sets indexes from BGNINDX to ENDINDX inclusive.
The palette data is represented as three words (16 bit) per index and ordered
red first, then green, blue last, for each index. The value of each word is
0 = fully off, and FFFF = fully on. Note that if the device supports less
than 16 bits per palette color, then it is the most significant bits in the
word that are used.
The plNum defines which palette table to modify, the default is 0. If other
palette tables are supported, they are numbered 1..nindexes from bgnIdx to
endIdx inclusive. The palette data is represented as three words (16 bit)
per index and ordered red first, then green, blue last, for each index. The
value of each word is 0 = fully off, and FFFF = fully on. Note that if the
device supports less than 16 bits per palette color, then it is the most
significant bits in the word that are used. */
void WritePalette(int plNum,int bgnIdx, int endIdx, palData *palPtr)
{
long dmParam;
long devMgrPal;
short grafErrValue; /* error value */
argsPalInfo dmParamPal; /* temp pal data */
dmParamPal.palNum = plNum; /* setup the device manager dmParam buffer */
dmParamPal.palBgn = bgnIdx;
dmParamPal.palEnd = endIdx;
dmParamPal.palDataPtr = palPtr;
dmParam = (long) &dmParamPal;
devMgrPal = DMWPAL; /* device manager write palette function */
/* call the device manager */
grafErrValue = thePort->portMap->mapDevMgr(thePort->portMap, devMgrPal, dmParam);
if (grafErrValue != 0)
{
grafErrValue = c_WritePal + c_InvDevFunc;
nuGrafErr(grafErrValue); /* report error */
return;
}
return;
}
/* Function ReadPalette returns the current value of color indexes from
bgnIdx to endIdx inclusive. */
void ReadPalette(int plNum,int bgnIdx, int endIdx, palData *palPtr)
{
long dmParam;
long devMgrPal;
short grafErrValue; /* error value */
argsPalInfo dmParamPal; /* temp pal data */
dmParamPal.palNum = plNum; /* setup the device manager dmParam buffer */
dmParamPal.palBgn = bgnIdx;
dmParamPal.palEnd = endIdx;
dmParamPal.palDataPtr = palPtr;
dmParam = (long) &dmParamPal;
devMgrPal = DMRPAL; /* device manager read palette function */
/* call the device manager */
grafErrValue = thePort->portMap->mapDevMgr(thePort->portMap, devMgrPal, dmParam);
if (grafErrValue != 0)
{
grafErrValue = c_ReadPale + c_InvDevFunc;
nuGrafErr(grafErrValue); /* report error */
return;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -