RWAP / PrinterToPDF

Project for converting captured printer data files to PDF format
GNU General Public License v3.0
85 stars 19 forks source link

Background colour of bmp and pdf is green #5

Closed Mike-DE-RE closed 7 years ago

Mike-DE-RE commented 7 years ago

No idea why, but background colour of the converted bmp and pdf files is dark green. Might be for testing but should be white or transparent at the end.

RWAP commented 7 years ago

I didn't get this on the Raspberry Pi - it was definitely white... Can you upload a sample .prn which shows this - see the image at http://www.retroprinter.com/first-test-new-escp2-conversion-routines/

Mike-DE-RE commented 7 years ago

Please see https://github.com/RWAP/PrinterToPDF/issues/6

Mike-DE-RE commented 7 years ago

Green background colour still there, even though using latest png version.

Mike-DE-RE commented 7 years ago

Can you please check is this part is correct?

if (isNthBitSet(colourValue, 6) ) { // Green 00FF00 // Mike-DE-RE (begin) // if (rgb1[0]>0) rgb1[0] = (rgb1[0] + 0) /2; if (rgb1[0]>0) rgb1[0] = (rgb1[0] + 255) /2; // Mike-DE-RE (end) if (blackSet || rgb1[1]>0) { rgb1[1] = (rgb1[1] + 255) /2; } else { rgb1[1] = 255; } if (rgb1[2]>0) rgb1[2] = (rgb1[2] + 0) /2; }

When I change it like in my comments, the complete page gets an orange background.

RWAP commented 7 years ago

It might be your version of gcc - try changing line 56 to read: Uint8 WHITE = 128

and line 176 to read: static Uint8 rgb1[3];

RWAP commented 7 years ago

Ah - someone has pointed out another bug which might explain this (to some extent - again possibly dependent on your version of gcc - I will update the source now to correct the bug

Mike-DE-RE commented 7 years ago

With the latest Version of code (10.05.2017, 22:15) the green background disappeared

... now it is black. ;-)

Mike-DE-RE commented 7 years ago

... which is a nice colour when you are having b/w printout, black on black is beautiful.

Mike-DE-RE commented 7 years ago

Checked with new source code (11.05.2017, 10:00):

test

Thanks god, I can see again!