Enginify trans_rect
Moves `trans_rect` to `engine` as `DrawHalfTransparentRectTo` and makes it operate on `CelOutputBuf`.
This commit is contained in:
parent
8101c61037
commit
83ce7c27af
15 changed files with 102 additions and 78 deletions
|
|
@ -555,6 +555,43 @@ void DrawLineTo(CelOutputBuffer out, int x0, int y0, int x1, int y1, BYTE color_
|
|||
}
|
||||
}
|
||||
|
||||
static void DrawHalfTransparentBlendedRectTo(CelOutputBuffer out, int sx, int sy, int width, int height)
|
||||
{
|
||||
BYTE *pix = out.at(sx, sy);
|
||||
for (int row = 0; row < height; row++) {
|
||||
for (int col = 0; col < width; col++) {
|
||||
*pix = paletteTransparencyLookup[0][*pix];
|
||||
pix++;
|
||||
}
|
||||
pix += out.line_width - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawHalfTransparentStippledRectTo(CelOutputBuffer out, int sx, int sy, int width, int height)
|
||||
{
|
||||
BYTE *pix = out.at(sx, sy);
|
||||
for (int row = 0; row < height; row++) {
|
||||
for (int col = 0; col < width; col++) {
|
||||
if ((row & 1 && col & 1) || (!(row & 1) && !(col & 1)))
|
||||
*pix = 0;
|
||||
pix++;
|
||||
}
|
||||
pix += out.line_width - width;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawHalfTransparentRectTo(CelOutputBuffer out, int sx, int sy, int width, int height)
|
||||
{
|
||||
int row, col;
|
||||
BYTE *pix = out.at(sx, sy);
|
||||
|
||||
if (sgOptions.bBlendedTransparancy) {
|
||||
DrawHalfTransparentBlendedRectTo(out, sx, sy, width, height);
|
||||
} else {
|
||||
DrawHalfTransparentStippledRectTo(out, sx, sy, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
int GetDirection(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int mx, my;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue