Fix transparency and printer issues:

- Fix transparency issue (RGB -> NGR).
- Fix a printer issue from Christoph Gießelink's HP82240B Printer Simulator version 1.12.
This commit is contained in:
dgis 2020-09-21 00:37:58 +02:00
parent 6e9f69e64a
commit c7608bbbed
3 changed files with 30 additions and 21 deletions

View file

@ -63,6 +63,12 @@ LINKS
CHANGES
Version 1.91 (2020-10-XX)
- Fix transparency issue (RGB -> NGR).
- Fix a printer issue from Christoph Gießelink's HP82240B Printer Simulator version 1.12.
Version 1.9 (2020-09-07)
- If the KML folder does not exist (like the first time), prompt the user to choose a new KML folder.

View file

@ -203,9 +203,9 @@ static void MakeBitmapTransparent(HBITMAP hBmp,COLORREF color,DWORD dwTol) {
DWORD dwGreen = 0x0000FF00;
DWORD dwBlue = 0x000000FF;
color = EncodeColorBits((color >> 16), dwBlue)
color = EncodeColorBits((color >> 0), dwBlue)
| EncodeColorBits((color >> 8), dwGreen)
| EncodeColorBits((color >> 0), dwRed);
| EncodeColorBits((color >> 16), dwRed);
DWORD dwBpp = (DWORD) (destinationBitCount >> 3);
LPBYTE pbyColor = pbyBits + (destinationHeight - 1) * destinationStride;

View file

@ -249,6 +249,7 @@ public class PrinterSimulator {
*/
private static final int[] wcRoman8 = new int[]
{
0x2591,
0x00A0, 0x00F7, 0x00D7, 0x221A, 0x222B, 0x03A3, 0x25B6, 0x03C0,
0x2202, 0x2264, 0x2265, 0x2260, 0x03B1, 0x2192, 0x2190, 0x00B5,
0x240A, 0x00B0, 0x00AB, 0x00BB, 0x22A6, 0x2081, 0x2082, 0x00B2,
@ -272,6 +273,7 @@ public class PrinterSimulator {
*/
private static final int[] wcEcma94 = new int[]
{
0x2591,
0x2221, 0x0101, 0x2207, 0x221A, 0x222B, 0x03A3, 0x25B6, 0x03C0,
0x2202, 0x2264, 0x2265, 0x2260, 0x03B1, 0x2192, 0x2190, 0x2193,
0x2191, 0x03B3, 0x03B4, 0x03B5, 0x03B7, 0x03B8, 0x03BB, 0x03C1,
@ -305,10 +307,13 @@ public class PrinterSimulator {
break; // no print
// normal 7bit ASCII character
if (byData < 128)
//if (byData < 128)
if (byData < (256 - wcRoman8.length))
textUpdate.append((char)byData);
else {
byData -= 128; // index to table
//byData -= 128; // index to table
// index to table
byData -= (256 - wcRoman8.length);
if (!m_bEcma94)
textUpdate.append((char)wcRoman8[byData]);
@ -393,17 +398,21 @@ public class PrinterSimulator {
}
private void SetSeparatorColumn()
{
if (m_nCurCol > 0) // not in first column
{
int byData = m_bUnderLined ? 0x80 : 0x00;
// no. of separator columns
int i = m_bExpChar ? 2 : 1;
while (--i >= 0) // write separator columns
// write separator columns when not in last column
while (--i >= 0 && m_nCurCol < LINE_WIDTH)
{
SetColumn(byData); // set empty column
}
}
}
private void addGraphData(int byData, boolean bGraphicData) {
if (m_nCurRow >= MAXPRTLINES*LINE_HEIGHT) // reached bitmap size
@ -452,10 +461,7 @@ public class PrinterSimulator {
: sFontEcma94_B[byData];
}
if (m_nCurCol > 0) // not in first column
{
SetSeparatorColumn();
}
for (i = 0; i < 5; ++i)
{
@ -472,12 +478,9 @@ public class PrinterSimulator {
}
}
if (m_nCurCol < LINE_WIDTH) // not in last column
{
SetSeparatorColumn();
}
}
}
while (false);
}
}