📄 hal_ink.c
字号:
}
/*-------------------------------------------------------------------------*/
void seSetCrtInkPixel(long x, long y, DWORD color)
{
DWORD StartLinearAddress;
unsigned regDisplayMode;
unsigned width;
StartLinearAddress = seGetCrtInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
width = (seReadRegByte( REG_CRTTV_HDP ) + 1) * 8;
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
_Pixel2bpp( StartLinearAddress, width/4, x, y, color);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seSetTvInkPixel(long x, long y, DWORD color)
{
seSetCrtInkPixel(x, y, color);
}
/*-------------------------------------------------------------------------*/
void seSetInkPixel( long x, long y, DWORD color )
{
DWORD StartLinearAddress;
unsigned regDisplayMode;
unsigned width;
StartLinearAddress = seGetInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
if (_ActiveImageSurface->DisplayMode & (CRT | TV))
width = (seReadRegByte( REG_CRTTV_HDP ) + 1) * 8;
else
width = (seReadRegByte( REG_LCD_HDP ) + 1) * 8;
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
_Pixel2bpp( StartLinearAddress, width/4, x, y, color);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seDrawLcdInkLine(long x1, long y1, long x2, long y2, DWORD color)
{
DWORD StartLinearAddress;
unsigned regDisplayMode;
unsigned width;
StartLinearAddress = seGetLcdInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
width = (seReadRegByte(REG_LCD_HDP) + 1) * 8;
if (x1 > x2)
{
_Swap(&x1, &x2);
_Swap(&y1, &y2);
}
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
_Line(StartLinearAddress, width/4, x1, y1, x2, y2, color, _Pixel2bpp);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seDrawCrtInkLine(long x1, long y1, long x2, long y2, DWORD color)
{
DWORD StartLinearAddress;
unsigned regDisplayMode;
unsigned width;
StartLinearAddress = seGetCrtInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
width = (seReadRegByte(REG_CRTTV_HDP) + 1) * 8;
if (x1 > x2)
{
_Swap(&x1, &x2);
_Swap(&y1, &y2);
}
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
_Line(StartLinearAddress, width/4, x1, y1, x2, y2, color, _Pixel2bpp);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seDrawTvInkLine(long x1, long y1, long x2, long y2, DWORD color)
{
seDrawCrtInkLine(x1, y1, x2, y2, color);
}
/*-------------------------------------------------------------------------*/
void seDrawInkLine(long x1, long y1, long x2, long y2, DWORD color)
{
DWORD StartLinearAddress;
unsigned regDisplayMode;
unsigned width;
StartLinearAddress = seGetInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
if (_ActiveImageSurface->DisplayMode & (CRT | TV))
width = (seReadRegByte( REG_CRTTV_HDP ) + 1) * 8;
else
width = (seReadRegByte( REG_LCD_HDP ) + 1) * 8;
if (x1 > x2)
{
_Swap(&x1, &x2);
_Swap(&y1, &y2);
}
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
_Line(StartLinearAddress, width/4, x1, y1, x2, y2, color, _Pixel2bpp);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seDrawLcdInkRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
unsigned BytesPerScanline;
DWORD StartLinearAddress;
unsigned regDisplayMode;
void (*linefn)(DWORD,int,long,long,long,long,DWORD);
long y;
unsigned width, height;
StartLinearAddress = seGetLcdInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
if (y1 > y2)
{
y = y2;
y2 = y1;
y1 = y;
}
linefn = _Line2bpp;
/*
** Calculate Bytes Per Scanline for 2 bpp.
** Note that seGetBytesPerScanline() can't be used directly since it uses
** the current bpp mode, not 2 bpp.
*/
seGetLcdResolution(&width, &height);
BytesPerScanline = width / 4;
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
if (SolidFill)
{
for (y = y1; y <= y2; y++)
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y, x2, y, color);
}
else
{
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y1, x2, y1, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y2, x2, y2, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y1, x1, y2, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x2, y1, x2, y2, color);
}
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seDrawCrtInkRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
unsigned BytesPerScanline;
DWORD StartLinearAddress;
unsigned regDisplayMode;
void (*linefn)(DWORD,int,long,long,long,long,DWORD);
long y;
unsigned width, height;
StartLinearAddress = seGetCrtInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
if (y1 > y2)
{
y = y2;
y2 = y1;
y1 = y;
}
linefn = _Line2bpp;
/*
** Calculate Bytes Per Scanline for 2 bpp.
** Note that seGetBytesPerScanline() can't be used directly since it uses
** the current bpp mode, not 2 bpp.
*/
seGetCrtResolution(&width, &height);
BytesPerScanline = width / 4;
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
if (SolidFill)
{
for (y = y1; y <= y2; y++)
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y, x2, y, color);
}
else
{
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y1, x2, y1, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y2, x2, y2, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y1, x1, y2, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x2, y1, x2, y2, color);
}
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
void seDrawTvInkRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
seDrawCrtInkRect(x1, y1, x2, y2, color, SolidFill);
}
/*-------------------------------------------------------------------------*/
void seDrawInkRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
unsigned BytesPerScanline;
DWORD StartLinearAddress;
unsigned regDisplayMode;
void (*linefn)(DWORD,int,long,long,long,long,DWORD);
long y;
unsigned width, height;
StartLinearAddress = seGetInkLinearAddress();
/*
** If in rotate90 mode, get out of rotate90 mode.
*/
regDisplayMode = seReadRegByte(REG_DISPLAY_MODE);
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode & ~0x40);
if (y1 > y2)
{
y = y2;
y2 = y1;
y1 = y;
}
linefn = _Line2bpp;
/*
** Calculate Bytes Per Scanline for 2 bpp.
** Note that seGetBytesPerScanline() can't be used directly since it uses
** the current bpp mode, not 2 bpp.
*/
seGetResolution(&width, &height);
BytesPerScanline = width / 4;
/*
** Each line in the ink layer has the same number of pixels as the
** physical width of the display. Since the ink layer is in 2 bpp
** mode, there are width/4 bytes per line.
*/
if (SolidFill)
{
for (y = y1; y <= y2; y++)
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y, x2, y, color);
}
else
{
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y1, x2, y1, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y2, x2, y2, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x1, y1, x1, y2, color);
(*linefn)(StartLinearAddress, BytesPerScanline, x2, y1, x2, y2, color);
}
seWriteRegByte(REG_DISPLAY_MODE, regDisplayMode);
}
/*-------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -