📄 hal_lut.c
字号:
/*
**===========================================================================
** HAL_LUT.C - This module contains the LUT routines for the HAL.
**---------------------------------------------------------------------------
** Copyright (c) 2000, 2001 Epson Research and Development, Inc.
** All Rights Reserved.
**===========================================================================
*/
#include "hal.h"
#include "assert.h"
#include "nonsefns.h"
/*-------------------------------------------------------------------------*/
static const char Revision[] = "HAL_LUT.C=$Revision: 6 $";
/*-------------------------------------------------------------------------*/
/*
** _WriteLut()
**
** This function sets either all or a portion of the 256 color LUT.
**
*/
void _WriteLut(BYTE *pLut, int count)
{
int idx;
ASSERT(count < 256);
for (idx = 0; idx < count; idx++)
{
seWriteRegByte(REG_LUT_RED_WRITE_DATA, pLut[HAL_RED]);
seWriteRegByte(REG_LUT_GREEN_WRITE_DATA, pLut[HAL_GREEN]);
seWriteRegByte(REG_LUT_BLUE_WRITE_DATA, pLut[HAL_BLUE]);
seWriteRegByte(REG_LUT_WRITE_ADDR, (BYTE) idx);
pLut += 3;
}
}
/*-------------------------------------------------------------------------*/
/*
** seWriteLut()
**
** This function sets either all or a portion of the 256 color LUT.
**
*/
void seWriteLut(BYTE *pLUT, int count)
{
_WriteLut(pLUT, count);
}
/*-------------------------------------------------------------------------*/
/*
** seReadLut()
**
** This routine reads the entire LUT and puts the results in
** the array pointed to by pLut.
*/
void seReadLut(BYTE *pLut, int count)
{
int idx;
DWORD val;
ASSERT( count < 256 );
for (idx = 0; idx < count; ++idx)
{
seWriteRegByte(REG_LUT_READ_ADDR, idx);
val = seReadRegDword(REG_LUT_BLUE_READ_DATA);
pLut[HAL_RED] = (BYTE) ((val >> 16) & 0xff);
pLut[HAL_GREEN] = (BYTE) ((val >> 8) & 0xff);
pLut[HAL_BLUE] = (BYTE) (val & 0xff);
pLut += 3;
}
}
/*-------------------------------------------------------------------------*/
/*
** _WriteLutEntry()
**
** This function writes just one LUT entry.
**
** NOTE:
**
** - pColor must point to a valid LUT data entry (BYTE color[3])
**
*/
void _WriteLutEntry(int index, BYTE *pColor)
{
ASSERT( index < 256 );
seWriteRegByte(REG_LUT_RED_WRITE_DATA, pColor[HAL_RED]);
seWriteRegByte(REG_LUT_GREEN_WRITE_DATA, pColor[HAL_GREEN]);
seWriteRegByte(REG_LUT_BLUE_WRITE_DATA, pColor[HAL_BLUE]);
seWriteRegByte(REG_LUT_WRITE_ADDR, (BYTE) index);
}
/*-------------------------------------------------------------------------*/
/*
** seWriteLutEntry()
**
** This function writes just one LUT entry.
**
** NOTE:
**
** - pColor must point to a valid LUT data entry (BYTE color[3])
**
*/
void seWriteLutEntry(int index, BYTE *pColor)
{
_WriteLutEntry(index, pColor);
}
/*-------------------------------------------------------------------------*/
/*
** seReadLutEntry()
**
** This function reads just one LUT entry.
**
** NOTE:
** - pColor must point to a valid LUT data entry (BYTE color[3])
*/
void seReadLutEntry(int index, BYTE *pColor)
{
DWORD val;
ASSERT( index < 256);
seWriteRegByte(REG_LUT_READ_ADDR, index);
val = seReadRegDword(REG_LUT_BLUE_READ_DATA);
pColor[HAL_RED] = (BYTE) ((val >> 16) & 0xff);
pColor[HAL_GREEN] = (BYTE) ((val >> 8) & 0xff);
pColor[HAL_BLUE] = (BYTE) (val & 0xff);
}
/*-------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -