CUPS rastertoql filter  1.0.4
Filter for the Brother QL family of label printers
Data Structures | Functions | Variables
qlmonochrome.c File Reference

Creating the printer's wire data for monochrome print. More...

Data Structures

struct  monochrome_line_start
 

Functions

static void monochrome_line_convert (size_t input_cnt, const signed short input[input_cnt], struct line_command *cmd)
 
static struct line_commandmonochrome_command_get (size_t bytes_per_line)
 
static void monochrome_command_put (void *buffer)
 
static int ql_next_monochrome_line_read (struct qldriver *ql, struct halftone_converter *cnv)
 
static int cups_ql_monochrome_line_process (struct qldriver *ql, struct halftone_converter *cnv)
 
int cups_ql_monochome_page_print (struct qldriver *ql, int first_time)
 

Variables

int terminate
 

Detailed Description

Creating the printer's wire data for monochrome print.

Author
Jürgen Borleis

Routines to print monochrome rasters, e.g. black on white. This mode can be used by all label printers.

Function Documentation

◆ cups_ql_monochome_page_print()

int cups_ql_monochome_page_print ( struct qldriver ql,
int  first_time 
)

Convert the current page into the printer's wire data format

Parameters
[in]qlFull job description
[in]first_time'1' if called the first time in this job, '0' else
Return values
0On success
-EINVALUnsupported raster input format
-ECANCELEDTermination request from outerspace

The routine loops through all or the remaining lines of the current page and converts them into the printer's monchrome wire format

Note
The ql_trim::top_keep amount of lines of the input raster is printed.
In case of an error or a termination request, the print job gets terminated at the printer's side as well.
Precondition
The format was already checked, e.g. it fits into the printer's media.

◆ cups_ql_monochrome_line_process()

static int cups_ql_monochrome_line_process ( struct qldriver ql,
struct halftone_converter cnv 
)
static

Process one monochrome line and send it to the printer

Parameters
[in]qlFull job description
[in,out]cnvHalf tone converter
Return values
0On success
Precondition
The half tone converter must be filled with two lines
One of the three available half-tone algorithms must already be selected

◆ monochrome_command_get()

static struct line_command* monochrome_command_get ( size_t  bytes_per_line)
static

Allocate the buffer for the monochrome print command

Parameters
[in]bytes_per_lineExpected bytes per line to be sent to the printer
Returns
line_command structure

◆ monochrome_command_put()

static void monochrome_command_put ( void *  buffer)
static

Free the buffer for the monochrome print command

Parameters
[in]bufferThe buffer to be freed

◆ monochrome_line_convert()

static void monochrome_line_convert ( size_t  input_cnt,
const signed short  input[input_cnt],
struct line_command cmd 
)
static

Convert one line of data from the half-tone algorithm (e.g. one short int per pixel) into one monochrome line of printer data

Parameters
[in]input_cntSize of elements in input
[in]inputThe data from the half-tone algorithm
[out]cmdWhere to build the monochrome printer data and its command

◆ ql_next_monochrome_line_read()

static int ql_next_monochrome_line_read ( struct qldriver ql,
struct halftone_converter cnv 
)
static

Read in the next line from a CUPS monochrome raster right border aligned

Parameters
[in,out]qlFull job description
[in,out]cnvHalf tone converter
Return values
0On success
-ENODATAMature end of CUPS raster input data

Each raster must be handled right aligned in order to mirror the result prior sending it to the printer.

The raster can be wider or smaller than the printing area is. Deal with it.

Precondition
Expected is a raster with one grey byte per dot, 0x00 = black dot, 0xff = no dot

Variable Documentation

◆ terminate

int terminate

Change to '1' to signal the program should stop