?? hal_lut.c
字號:
/*
**===========================================================================
** HAL_LUT.C - This module contains the LUT routines for the 13506 HAL.
**---------------------------------------------------------------------------
** Copyright (c) 1997, 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: 12 $";
/*-------------------------------------------------------------------------*/
/*
** _WriteLut()
**
** This function sets either all or a portion of the 256 color LUT.
**
*/
void _WriteLut(int DisplayMode, BYTE *pLUT, int count)
{
int idx, rgb;
ASSERT( count <= 256 );
if (DisplayMode == LCD)
seWriteRegByte(REG_LUT_MODE, 0x01); /* write to LCD LUT */
else if ((DisplayMode == CRT) || (DisplayMode == TV))
seWriteRegByte(REG_LUT_MODE, 0x02); /* write to CRT/TV LUT */
else
seWriteRegByte(REG_LUT_MODE, 0x00); /* write to LCD and CRT/TV LUT */
seWriteRegByte( REG_LUT_ADDR, 0 );
for (idx = 0; idx < count; idx++)
{
for (rgb = 0; rgb < 3; rgb++)
seWriteRegByte( REG_LUT_DATA, *pLUT++ );
}
}
/*-------------------------------------------------------------------------*/
/*
** seWriteLut()
**
** This function sets either all or a portion of the 256 color LUT.
**
*/
void seWriteLut(BYTE *pLUT, int count)
{
_WriteLut(_ActiveImageSurface->DisplayMode, pLUT, count);
}
/*-------------------------------------------------------------------------*/
void seWriteLcdLut(BYTE *pLUT, int count)
{
_WriteLut(LCD, pLUT, count);
}
/*-------------------------------------------------------------------------*/
void seWriteCrtLut(BYTE *pLUT, int count)
{
_WriteLut(CRT, pLUT, count);
}
/*-------------------------------------------------------------------------*/
void seWriteTvLut(BYTE *pLUT, int count)
{
_WriteLut(TV, 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, rgb;
ASSERT( count <= 256 );
if ( (_ActiveImageSurface->DisplayMode & (CRT | TV)) &&
!(_ActiveImageSurface->DisplayMode & LCD))
seWriteRegByte(REG_LUT_MODE, 0x02); /* read from CRT/TV LUT */
else
seWriteRegByte(REG_LUT_MODE, 0x01); /* read from LCD LUT */
seWriteRegByte( REG_LUT_ADDR, 0 );
for (idx = 0; idx < count; ++idx)
{
for (rgb = 0; rgb < 3; ++rgb)
*pLUT++ = (BYTE) seReadRegByte( REG_LUT_DATA );
}
}
/*-------------------------------------------------------------------------*/
void seReadLcdLut(BYTE *pLUT, int count)
{
int idx, rgb;
ASSERT( count <= 256 );
seWriteRegByte(REG_LUT_MODE, 0x01); /* read from LCD LUT */
seWriteRegByte(REG_LUT_ADDR, 0);
for (idx = 0; idx < count; ++idx)
{
for (rgb = 0; rgb < 3; ++rgb)
*pLUT++ = (BYTE) seReadRegByte( REG_LUT_DATA );
}
}
/*-------------------------------------------------------------------------*/
void seReadCrtLut(BYTE *pLUT, int count)
{
int idx, rgb;
ASSERT( count <= 256 );
seWriteRegByte(REG_LUT_MODE, 0x02); /* read from CRT/TV LUT */
seWriteRegByte( REG_LUT_ADDR, 0 );
for (idx = 0; idx < count; ++idx)
{
for (rgb = 0; rgb < 3; ++rgb)
*pLUT++ = (BYTE) seReadRegByte( REG_LUT_DATA );
}
}
/*-------------------------------------------------------------------------*/
void seReadTvLut(BYTE *pLUT, int count)
{
seReadCrtLut(pLUT, count);
}
/*-------------------------------------------------------------------------*/
/*
** _WriteLutEntry()
**
** This function writes just one LUT entry.
** This function does not use the display surface.
**
** NOTE:
**
** - pLUT must point to a valid LUT data entry (BYTE color[3])
**
*/
void _WriteLutEntry(int DisplayMode, int index, BYTE *pColor)
{
ASSERT( index <= 256 );
if (DisplayMode == LCD)
seWriteRegByte(REG_LUT_MODE, 0x01); /* write to LCD LUT */
else if (DisplayMode & (CRT | TV))
seWriteRegByte(REG_LUT_MODE, 0x02); /* write to CRT/TV LUT */
else
seWriteRegByte(REG_LUT_MODE, 0x00); /* write to LCD and CRT/TV LUT */
seWriteRegByte( REG_LUT_ADDR, (BYTE) index );
seWriteRegByte( REG_LUT_DATA, *pColor++ );
seWriteRegByte( REG_LUT_DATA, *pColor++ );
seWriteRegByte( REG_LUT_DATA, *pColor );
}
/*-------------------------------------------------------------------------*/
/*
** seWriteLutEntry()
**
** This function writes just one LUT entry.
**
** NOTE:
**
** - pLUT must point to a valid LUT data entry (BYTE lut[3])
**
*/
void seWriteLutEntry(int index, BYTE *pColor)
{
_WriteLutEntry(_ActiveImageSurface->DisplayMode, index, pColor);
}
/*-------------------------------------------------------------------------*/
void seWriteLcdLutEntry(int index, BYTE *pColor)
{
_WriteLutEntry(LCD, index, pColor);
}
/*-------------------------------------------------------------------------*/
void seWriteCrtLutEntry(int index, BYTE *pColor)
{
_WriteLutEntry(CRT, index, pColor);
}
/*-------------------------------------------------------------------------*/
void seWriteTvLutEntry(int index, BYTE *pColor)
{
_WriteLutEntry(TV, index, pColor);
}
/*-------------------------------------------------------------------------*/
/*
** _ReadLcdLutEntry()
**
** This function reads just one LUT entry.
**
** NOTE:
**
** - pColor must point to a valid LUT data entry (BYTE color[3])
*/
void seReadLcdLutEntry(int index, BYTE *pColor)
{
ASSERT( index < 256);
seWriteRegByte(REG_LUT_MODE, 0x01); /* read from LCD LUT */
seWriteRegByte( REG_LUT_ADDR, (BYTE) index );
*pColor++ = (BYTE) seReadRegByte( REG_LUT_DATA );
*pColor++ = (BYTE) seReadRegByte( REG_LUT_DATA );
*pColor = (BYTE) seReadRegByte( REG_LUT_DATA );
}
/*-------------------------------------------------------------------------*/
/*
** seReadCrtLutEntry()
**
** This function reads just one LUT entry.
**
** NOTE:
**
** - pColor must point to a valid LUT data entry (BYTE color[3])
*/
void seReadCrtLutEntry(int index, BYTE *pColor)
{
ASSERT( index < 256);
seWriteRegByte(REG_LUT_MODE, 0x02); /* read from CRT/TV LUT */
seWriteRegByte( REG_LUT_ADDR, (BYTE) index );
*pColor++ = (BYTE) seReadRegByte( REG_LUT_DATA );
*pColor++ = (BYTE) seReadRegByte( REG_LUT_DATA );
*pColor = (BYTE) seReadRegByte( REG_LUT_DATA );
}
/*-------------------------------------------------------------------------*/
void seReadTvLutEntry(int index, BYTE *pColor)
{
seReadCrtLutEntry(index, pColor);
}
/*-------------------------------------------------------------------------*/
/*
** seReadLutEntry()
**
** This function reads just one LUT entry.
**
** NOTE:
**
** - pLUT must point to a valid LUT data entry (BYTE lut[3])
*/
void seReadLutEntry(int index, BYTE *pColor)
{
ASSERT( index < 256);
if ( (_ActiveImageSurface->DisplayMode & (CRT | TV)) &&
!(_ActiveImageSurface->DisplayMode & LCD))
seReadCrtLutEntry(index, pColor);
else
seReadLcdLutEntry(index, pColor);
}
/*-------------------------------------------------------------------------*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -