📄 hal_draw.c
字号:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel16bpp);
break;
}
}
/*-------------------------------------------------------------------------*/
void seDrawSubWinLine(long x1, long y1, long x2, long y2, DWORD color)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
x1 += _SubWinSurface.xOffset;
x2 += _SubWinSurface.xOffset;
BytesPerScanline = seGetSubWinBytesPerScanline();
if (x1 > x2)
{
_Swap(&x1, &x2);
_Swap(&y1, &y2);
}
/*
** Switch based on the pixel depth (BPP)
*/
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _SubWinSurface.LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
/*
** Diagonal lines
*/
switch (BitsPerPixel)
{
case 1:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel1bpp);
break;
case 2:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel2bpp);
break;
case 4:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel4bpp);
break;
case 8:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel8bpp);
break;
case 16:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel16bpp);
break;
}
}
/*-------------------------------------------------------------------------*/
void seDrawLine(long x1, long y1, long x2, long y2, DWORD color)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
x1 += _ActiveImageSurface->xOffset;
x2 += _ActiveImageSurface->xOffset;
BytesPerScanline = seGetBytesPerScanline();
if (x1 > x2)
{
_Swap(&x1, &x2);
_Swap(&y1, &y2);
}
/*
** Switch based on the pixel depth (BPP)
*/
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _ActiveImageSurface->LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
/*
** Diagonal lines
*/
switch (BitsPerPixel)
{
case 1:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel1bpp);
break;
case 2:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel2bpp);
break;
case 4:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel4bpp);
break;
case 8:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel8bpp);
break;
case 16:
_Line(LinearAddress, BytesPerScanline, x1, y1, x2, y2, color, _Pixel16bpp);
break;
}
}
/*-------------------------------------------------------------------------*/
void seDrawMainWinRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
void (*linefn)(DWORD,int,long,long,long,long,DWORD);
long y;
x1 += _MainWinSurface.xOffset;
x2 += _MainWinSurface.xOffset;
if (y1 > y2)
{
y = y2;
y2 = y1;
y1 = y;
}
BytesPerScanline = seGetMainWinBytesPerScanline();
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _MainWinSurface.LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
switch (BitsPerPixel)
{
case 1:
linefn = _Line1bpp;
break;
case 2:
linefn = _Line2bpp;
break;
case 4:
linefn = _Line4bpp;
break;
case 8:
default:
linefn = _Line8bpp;
break;
case 16:
linefn = _Line16bpp;
break;
}
if (SolidFill)
{
for (y = y1; y <= y2; y++)
(*linefn)(LinearAddress, BytesPerScanline, x1, y, x2, y, color);
}
else
{
(*linefn)(LinearAddress, BytesPerScanline, x1, y1, x2, y1, color);
(*linefn)(LinearAddress, BytesPerScanline, x1, y2, x2, y2, color);
(*linefn)(LinearAddress, BytesPerScanline, x1, y1, x1, y2, color);
(*linefn)(LinearAddress, BytesPerScanline, x2, y1, x2, y2, color);
}
}
/*-------------------------------------------------------------------------*/
void seDrawSubWinRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
void (*linefn)(DWORD,int,long,long,long,long,DWORD);
long y;
x1 += _SubWinSurface.xOffset;
x2 += _SubWinSurface.xOffset;
if (y1 > y2)
{
y = y2;
y2 = y1;
y1 = y;
}
BytesPerScanline = seGetSubWinBytesPerScanline();
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _SubWinSurface.LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
switch (BitsPerPixel)
{
case 1:
linefn = _Line1bpp;
break;
case 2:
linefn = _Line2bpp;
break;
case 4:
linefn = _Line4bpp;
break;
case 8:
default:
linefn = _Line8bpp;
break;
case 16:
linefn = _Line16bpp;
break;
}
if (SolidFill)
{
for (y = y1; y <= y2; y++)
(*linefn)(LinearAddress, BytesPerScanline, x1, y, x2, y, color);
}
else
{
(*linefn)(LinearAddress, BytesPerScanline, x1, y1, x2, y1, color);
(*linefn)(LinearAddress, BytesPerScanline, x1, y2, x2, y2, color);
(*linefn)(LinearAddress, BytesPerScanline, x1, y1, x1, y2, color);
(*linefn)(LinearAddress, BytesPerScanline, x2, y1, x2, y2, color);
}
}
/*-------------------------------------------------------------------------*/
void seDrawRect(long x1, long y1, long x2, long y2, DWORD color, BOOL SolidFill)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
void (*linefn)(DWORD,int,long,long,long,long,DWORD);
long y;
x1 += _ActiveImageSurface->xOffset;
x2 += _ActiveImageSurface->xOffset;
if (y1 > y2)
{
y = y2;
y2 = y1;
y1 = y;
}
BytesPerScanline = seGetBytesPerScanline();
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _ActiveImageSurface->LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
switch (BitsPerPixel)
{
case 1:
linefn = _Line1bpp;
break;
case 2:
linefn = _Line2bpp;
break;
case 4:
linefn = _Line4bpp;
break;
case 8:
default:
linefn = _Line8bpp;
break;
case 16:
linefn = _Line16bpp;
break;
}
if (SolidFill)
{
for (y = y1; y <= y2; y++)
(*linefn)(LinearAddress, BytesPerScanline, x1, y, x2, y, color);
}
else
{
(*linefn)(LinearAddress, BytesPerScanline, x1, y1, x2, y1, color);
(*linefn)(LinearAddress, BytesPerScanline, x1, y2, x2, y2, color);
(*linefn)(LinearAddress, BytesPerScanline, x1, y1, x1, y2, color);
(*linefn)(LinearAddress, BytesPerScanline, x2, y1, x2, y2, color);
}
}
/*-------------------------------------------------------------------------*/
void seDrawMainWinEllipse(long xc, long yc, long xr, long yr, DWORD color)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
xc += _MainWinSurface.xOffset;
BytesPerScanline = seGetMainWinBytesPerScanline();
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _MainWinSurface.LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
switch (BitsPerPixel)
{
case 1:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel1bpp);
break;
case 2:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel2bpp);
break;
case 4:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel4bpp);
break;
case 8:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel8bpp);
break;
case 16:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel16bpp);
break;
}
}
/*-------------------------------------------------------------------------*/
void seDrawSubWinEllipse(long xc, long yc, long xr, long yr, DWORD color)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
xc += _SubWinSurface.xOffset;
BytesPerScanline = seGetSubWinBytesPerScanline();
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _SubWinSurface.LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
switch (BitsPerPixel)
{
case 1:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel1bpp);
break;
case 2:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel2bpp);
break;
case 4:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel4bpp);
break;
case 8:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel8bpp);
break;
case 16:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel16bpp);
break;
}
}
/*-------------------------------------------------------------------------*/
void seDrawEllipse(long xc, long yc, long xr, long yr, DWORD color)
{
unsigned BytesPerScanline;
unsigned BitsPerPixel;
DWORD LinearAddress;
xc += _ActiveImageSurface->xOffset;
BytesPerScanline = seGetBytesPerScanline();
BitsPerPixel = seGetBitsPerPixel();
LinearAddress = _ActiveImageSurface->LinearAddress;
#ifdef LINEAR_ADDRESSES_SUPPORTED
if (LinearAddress == 0)
return;
#else
if (LinearAddress == -1)
return;
#endif
switch (BitsPerPixel)
{
case 1:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel1bpp);
break;
case 2:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel2bpp);
break;
case 4:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel4bpp);
break;
case 8:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel8bpp);
break;
case 16:
_Ellipse(LinearAddress, BytesPerScanline, xc, yc, xr, yr, color, _Pixel16bpp);
break;
}
}
/*-------------------------------------------------------------------------*/
void seDrawMainWinCircle(long xCenter, long yCenter, long radius, DWORD color)
{
seDrawMainWinEllipse(xCenter, yCenter, radius, radius, color);
}
/*-------------------------------------------------------------------------*/
void seDrawSubWinCircle(long xCenter, long yCenter, long radius, DWORD color)
{
seDrawSubWinEllipse(xCenter, yCenter, radius, radius, color);
}
/*-------------------------------------------------------------------------*/
void seDrawCircle(long xCenter, long yCenter, long radius, DWORD color)
{
seDrawEllipse(xCenter, yCenter, radius, radius, color);
}
/*-------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -