📄 m1b_fil.c
字号:
if (pnColr == 1) pnColr = 0xff; */
if (pnColr == 1) pnColr = (char) 0xff;
bkColr = bkColr & 0x01;
/* BobB 5/14/99 - corrected the following line to remove a compiler warning
if (bkColr == 1) bkColr = 0xff; */
if (bkColr == 1) bkColr = (char) 0xff;
optPtr(); /* blit the rectangle */
return;
}
/* Function InvertDestM1Bit inverts the destination pixel data. */
void InvertDestM1Bit(void)
{
short lclYmin, lclShift;
int lclLineCnt, lclByteCnt;
int pxShift;
byte pxBit;
lclLineCnt = lineCntM1;
lclYmin = dRect.Ymin;
pxShift = (dRect.Xmin & firstOffset);
lclShift = 8;
while (lclLineCnt-- >= 0)
{ /* for each row */
dstPtr = (byte *) (*(dstBmap->mapTable[0] + lclYmin))
+ dstBgnByte;
lclByteCnt = byteCntM1;
/* check if first pixel aligned */
if (pxShift != 0)
{ /* no, align it */
pxBit = (byte) (shiftMask >> pxShift);
while (pxBit > 0)
{
*dstPtr = *dstPtr ^ pxBit;
pxBit = (pxBit >> shfCnt);
lclByteCnt--;
if (lclByteCnt < 0) break;
}
dstPtr++;
}
/* do the whole bytes */
while (lclByteCnt >= lclShift)
{ /* for each byte in the row */
*dstPtr = ~*dstPtr;
dstPtr++;
lclByteCnt -= lclShift;
}
/* do the last pixels if any */
if (lclByteCnt >= 0)
{
pxBit = 0x80;
while (lclByteCnt-- >= 0)
{
*dstPtr = *dstPtr ^ pxBit;
pxBit = (pxBit >> shfCnt);
}
}
lclYmin++; /* advance to next row */
}
return;
}
/* Function SetDestM1Bit sets the destination pixel data. */
void SetDestM1Bit(void)
{
int lclLineCnt, lclByteCnt;
int pxShift, lclShift;
byte pxBit;
lclLineCnt = lineCntM1;
pxShift = (dRect.Xmin & firstOffset);
lclShift = 8;
while (lclLineCnt-- >= 0)
{ /* for each row */
dstPtr = (byte *) (*(dstBmap->mapTable[0] + dRect.Ymin))
+ dstBgnByte;
lclByteCnt = byteCntM1;
/* check if first pixel aligned */
if (pxShift != 0)
{ /* no, align it */
pxBit = (byte) (shiftMask >> pxShift);
while (pxBit > 0)
{
*dstPtr = (*dstPtr & ~pxBit) | (pxBit & pnColr);
pxBit = (pxBit >> shfCnt);
lclByteCnt--;
if (lclByteCnt < 0) break;
}
dstPtr++;
}
/* do the whole bytes */
while (lclByteCnt >= lclShift)
{ /* for each byte in the row */
*dstPtr = pnColr;
dstPtr++;
lclByteCnt -= lclShift;
}
/* do the last pixels if any */
if (lclByteCnt >= 0)
{
pxBit = 0x80;
while (lclByteCnt-- >= 0)
{
*dstPtr = (*dstPtr & ~pxBit) | (pxBit & pnColr);
pxBit = (pxBit >> shfCnt);
}
}
dRect.Ymin++; /* advance to next row */
}
return;
}
/* Function NotDestFillM1Bit handles memory "not dst" by inverting the
destination first. */
void NotDestFillM1Bit(void)
{
void InvertDestM1Bit(void);
void FillOXADestM1Bit(void);
InvertDestM1Bit();
FillOXADestM1Bit(); /* fill this rectangle */
return;
}
/* Function NotDestMonoFillM1Bit handles memory "not dst" by inverting
the destination first. */
void NotDestMonoFillM1Bit(void)
{
void InvertDestM1Bit(void);
void MonoFillOXADestM1Bit(void);
InvertDestM1Bit();
MonoFillOXADestM1Bit(); /* fill this rectangle */
return;
}
/* Function MonoFillDestM1Bit sets the destination pixel data to pnColr
if the source is 1 else bkColr. */
void MonoFillDestM1Bit(void)
{
int lclLineCnt, lclByteCnt;
int ptrnX, ptrnY, ptrnByte, ptrnBt, ptrnColr;
int pxShift;
byte pxBit;
lclLineCnt = lineCntM1;
ptrnY = dRect.Ymin % patHeight; /* start of pattern allignment */
ptrnY *= patWidthInBytes;
pxShift = (dRect.Xmin & firstOffset);
while (lclLineCnt-- >= 0)
{ /* for each row */
ptrnX = dRect.Xmin % patWidthInBytes;
ptrnBt = (128 >> (dRect.Xmin & 7));
ptrnByte = savePat->imData[ptrnX + ptrnY];
dstPtr = (byte *) (*(dstBmap->mapTable[0] + dRect.Ymin))
+ dstBgnByte;
lclByteCnt = byteCntM1;
pxBit = (byte) (shiftMask >> pxShift);
while (lclByteCnt-- >= 0)
{
if (ptrnByte & ptrnBt)
{
ptrnColr = pnColr;
}
else
{
ptrnColr = bkColr;
}
*dstPtr = (*dstPtr & ~pxBit) | (pxBit & ptrnColr);
pxBit = (pxBit >> shfCnt);
if (pxBit == 0)
{ /* advance to next byte */
dstPtr++;
pxBit = 0x80;
}
ptrnBt = ptrnBt >> 1;
if (ptrnBt == 0)
{
ptrnBt = 128;
ptrnX++;
if (ptrnX == patWidthInBytes) ptrnX = 0;
ptrnByte = savePat->imData[ptrnX + ptrnY];
}
}
dRect.Ymin++; /* advance to next row */
ptrnY += patWidthInBytes;
if (ptrnY == patLength) ptrnY = 0;
}
return;
}
/* Function FillOXADestM1Bit sets the destination pixel data based on
the logical function "OR", "XOR" or "AND". */
void FillOXADestM1Bit(void)
{
int lclLineCnt, lclByteCnt;
int pxShift, lclShift;
byte pxBit;
int logFnc;
lclLineCnt = lineCntM1;
pxShift = (dRect.Xmin & firstOffset);
lclShift = 8;
logFnc = (dstClass & 3); /* only two lower bits needed */
while (lclLineCnt-- >= 0)
{ /* for each row */
dstPtr = (byte *) (*(dstBmap->mapTable[0] + dRect.Ymin))
+ dstBgnByte;
lclByteCnt = byteCntM1;
/* check if first pixel aligned */
if (pxShift != 0)
{ /* no, align it */
pxBit = (byte) (shiftMask >> pxShift);
while (pxBit > 0)
{
switch (logFnc)
{
case 0: /* handled elsewhere */
case 1: /* "OR" */
*dstPtr = *dstPtr | (pxBit & pnColr);
break;
case 2: /* "XOR" */
*dstPtr = *dstPtr ^ (pxBit & pnColr);
break;
case 3: /* "AND" */
*dstPtr = *dstPtr & (~pxBit | (pxBit & pnColr));
}
pxBit = (pxBit >> shfCnt);
lclByteCnt--;
if (lclByteCnt < 0) break;
}
dstPtr++;
}
/* do the whole bytes */
while (lclByteCnt >= lclShift)
{ /* for each byte in the row */
switch (logFnc)
{
case 0: /* handled elsewhere */
case 1: /* "OR" */
*dstPtr = *dstPtr | pnColr;
break;
case 2: /* "XOR" */
*dstPtr = *dstPtr ^ pnColr;
break;
case 3: /* "AND" */
*dstPtr = *dstPtr & pnColr;
}
dstPtr++;
lclByteCnt -= lclShift;
}
/* do the last pixels if any */
if (lclByteCnt >= 0)
{
pxBit = 0x80;
while (lclByteCnt-- >= 0)
{
switch (logFnc)
{
case 0: /* handled elsewhere */
case 1: /* "OR" */
*dstPtr = *dstPtr | (pxBit & pnColr);
break;
case 2: /* "XOR" */
*dstPtr = *dstPtr ^ (pxBit & pnColr);
break;
case 3: /* "AND" */
*dstPtr = *dstPtr & (~pxBit | (pxBit & pnColr));
}
pxBit = (pxBit >> shfCnt);
}
}
dRect.Ymin++; /* advance to next row */
}
return;
}
/* Function MonoFillOXADestM1Bit sets the destination pixel data based on
the logical function "OR", "XOR" or "AND" and the pattern bit. */
void MonoFillOXADestM1Bit(void)
{
int lclLineCnt, lclByteCnt;
int ptrnX, ptrnY, ptrnByte, ptrnBt, ptrnColr;
int pxShift;
byte pxBit;
int logFnc;
lclLineCnt = lineCntM1;
ptrnY = dRect.Ymin % patHeight; /* start of pattern allignment */
ptrnY *= patWidthInBytes;
pxShift = (dRect.Xmin & firstOffset);
logFnc = (dstClass & 3); /* only two lower bits needed */
while (lclLineCnt-- >= 0)
{ /* for each row */
ptrnX = dRect.Xmin % patWidthInBytes;
ptrnBt = (128 >> (dRect.Xmin & 7));
ptrnByte = savePat->imData[ptrnX + ptrnY];
dstPtr = (byte *) (*(dstBmap->mapTable[0] + dRect.Ymin))
+ dstBgnByte;
lclByteCnt = byteCntM1;
pxBit = (byte) (shiftMask >> pxShift);
while (lclByteCnt-- >= 0)
{
if (ptrnByte & ptrnBt)
{
ptrnColr = pnColr;
}
else
{
ptrnColr = bkColr;
}
switch (logFnc)
{
case 0: /* handled elsewhere */
case 1: /* "OR" */
*dstPtr = *dstPtr | (pxBit & ptrnColr);
break;
case 2: /* "XOR" */
*dstPtr = *dstPtr ^ (pxBit & ptrnColr);
break;
case 3: /* "AND" */
*dstPtr = *dstPtr & (~pxBit | (pxBit & ptrnColr));
}
pxBit = (pxBit >> shfCnt);
if (pxBit == 0)
{ /* advance to next byte */
dstPtr++;
pxBit = 0x80;
}
ptrnBt = ptrnBt >> 1;
if (ptrnBt == 0)
{
ptrnBt = 128;
ptrnX++;
if (ptrnX == patWidthInBytes) ptrnX = 0;
ptrnByte = savePat->imData[ptrnX + ptrnY];
}
}
dRect.Ymin++; /* advance to next row */
ptrnY += patWidthInBytes;
if (ptrnY == patLength) ptrnY = 0;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -