Browse Source

Files too large to print to one bmp now print to multiple bmps

master
surkeh 3 years ago
parent
commit
55cdaaa64a
3 changed files with 38 additions and 8 deletions
  1. 1
    1
      lib/PortLibC
  2. 8
    7
      src/Printer.cpp
  3. 29
    0
      src/main.cpp

+ 1
- 1
lib/PortLibC

@@ -1 +1 @@
Subproject commit a7749edff4e4155b4c6e986f8959fc3e17dd3099
Subproject commit 48d7ebe043a6cdf8bfb33e9af9ab15005cd07a1f

+ 8
- 7
src/Printer.cpp View File

@@ -28,6 +28,7 @@
// //
////////////////////////////////////////////////////////////////////////////////


#if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h>
#elif __linux__
@@ -905,16 +906,16 @@ static void Printnextpage(t_printdata *print) {
}
else {
// Save bitmap to file. First, get file name.
//fnsplit(print->outbmp,drv,dir,nam,ext, MAXPATH);
//if (ext[0]=='\0') strcpy(ext,".bmp");
//if (npages>1)
// sprintf(path,"%s%s%s_%04i%s",drv,dir,nam,print->frompage+1,ext);
//else
// sprintf(path,"%s%s%s%s",drv,dir,nam,ext);
fnsplit(print->outbmp,drv,dir,nam,ext);
if (ext[0]=='\0') strcpy(ext,".bmp");
if (npages>1)
sprintf(path,"%s%s%s_%04i%s",drv,dir,nam,print->frompage+1,ext);
else
sprintf(path,"%s%s%s%s",drv,dir,nam,ext);
// Create bitmap file.
//hbmpfile=CreateFile(path,GENERIC_WRITE,0,NULL,
// CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
hbmpfile = fopen (print->outbmp, "wb");
hbmpfile = fopen (path, "wb");
//if (hbmpfile==INVALID_HANDLE_VALUE) //
if (hbmpfile == NULL) {
Reporterror("Unable to create bitmap file");

+ 29
- 0
src/main.cpp View File

@@ -12,9 +12,38 @@
* Compiler: gcc
*
* Author: scuti@teknik.io
* surkeh@protonmail.com
*
* =====================================================================================
*/


////////////////////////////////////////////////////////////////////////////////
//
// Data is kept in matrix 32x32 points. It consists of:
//
// 4-byte address (combined with redundancy count) or special marker;
// 90-byte compressed and encrypted data;
// 2-byte CRC of address and data (CCITT version);
// 32-byte Reed-Solomon error correction code of the previous 96 bytes.
//
// Top left point is the LSB of the low byte of address. Second point in the
// topmost row is the second bit, etc. I have selected horizontal orientation
// of bytes because jet printers in draft mode may shift rows in X. This may
// lead to the loss of 4 bytes, but not 32 at once.
//
// Even rows are XORed with 0x55555555 and odd with 0xAAAAAAAA to prevent long
// lines or columns of zeros or ones in uncompressed data.
//
// For each ngroup=redundancy data blocks, program creates one artificial block
// filled with data which is the XOR of ngroup blocks, additionally XORed with
// 0xFF. Blocks within the group are distributed through the sheet into the
// different rows and columns, thus increasing the probability of data recovery,
// even if some parts are completely missing. Redundancy blocks contain ngroup
// in the most significant 4 bits.
//
////////////////////////////////////////////////////////////////////////////////

#include <stdlib.h>
#include <getopt.h>
#include <stdbool.h>

Loading…
Cancel
Save