1
0
mirror of https://github.com/pdewacht/brlaser synced 2025-04-07 05:06:45 +02:00
brlaser/src/job.h
xc-racer99 7e59e6147e Add duplex code for DCP-7065DN
The official Brother driver treats Tumble and NoTumble differently, adding &l2S and &l1S respectively to the header.

Unfortunately, for me this resulted in missing lines in NoTumble.  By treating everything as Tumble and simply sending data rotated 180 for Tumble we get a good quality printout.
2017-05-01 12:26:22 -07:00

68 lines
1.7 KiB
C++

// This file is part of the brlaser printer driver.
//
// Copyright 2013 Peter De Wachter
//
// brlaser is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// brlaser is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with brlaser. If not, see <http://www.gnu.org/licenses/>.
#ifndef JOB_H
#define JOB_H
#include <stdint.h>
#include <stdio.h>
#include <string>
struct page_params {
int num_copies;
int resolution;
bool duplex;
bool economode;
std::string sourcetray;
std::string mediatype;
std::string papersize;
bool operator==(const page_params &o) const {
return num_copies == o.num_copies
&& resolution == o.resolution
&& duplex == o.duplex
&& economode == o.economode
&& sourcetray == o.sourcetray
&& mediatype == o.mediatype
&& papersize == o.papersize;
}
};
class job {
public:
typedef bool (*nextline_fn)(uint8_t *buf);
explicit job(FILE *out, const std::string &job_name);
~job();
void encode_page(const page_params &params,
int lines,
int linesize,
nextline_fn nextline);
private:
void begin_job();
void end_job();
void write_page_header();
FILE *out_;
std::string job_name_;
page_params page_params_;
};
#endif // JOB_H