CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Emulate the unsupported colour formats and restore the raster. More...
Macros | |
#define | MONOCHROME0_WHITE 0xff |
#define | MONOCHROME1_WHITE 0x00 |
#define | LUMINANCE_WHITE 0xff |
#define | RGB_WHITE 0xff |
#define | CMYK_WHITE 0x00 |
Functions | |
static void | monochome_dots_wipe_out_left (size_t cnt, struct caps_dot_monochrome *buf, uint8_t nodot) |
static void | monochome_dots_wipe_out_right (size_t cnt, struct caps_dot_monochrome *buf, uint8_t nodot) |
static void | grey_dots_wipe_out (size_t cnt, struct caps_dot_grey buf[cnt]) |
static void | rgb_dots_wipe_out (size_t cnt, struct caps_dot_rgb *buf) |
static void | cmyk_dots_wipe_out (size_t cnt, struct caps_dot_cmyk *buf) |
static void * | empty_line (size_t dots_per_line, void *buf, enum caps_colour_format cf) |
static void * | line_buffer_allocate (void *buf, unsigned dots_per_line, enum caps_colour_format cf) |
static void | line_buffer_poisoning (void *buf, enum caps_colour_format cf, unsigned dot_cnt) |
const void * | caps_drv_raw_raster_line_get (struct caps_drv *cdrv, unsigned line_no) |
void * | caps_drv_raster_line_copy_get (struct caps_drv *cdrv, void *line_buf, unsigned line_no) |
void | caps_drv_emulation_stop (struct caps_drv *cdrv) |
static void | alloc_monochrome_buffer (struct caps_drv *cdrv) |
static void | read_and_store (struct caps_dot_monochrome *buf, struct drv_halftone_converter *htc, unsigned ll, unsigned no, unsigned expected_width, enum caps_colour_format cf) |
static void | monochrome_buffer_convert (struct caps_drv *cdrv, struct drv_halftone_converter *htc) |
static void | tweak_monochrome_position (struct caps_rstr_raster *desc) |
int | caps_drv_emulation_setup (struct caps_drv *cdrv) |
Drivers rely on the fact, they get a ready-to-use raster to convert and send it to the printer. But sometimes libcapsraster hasn't support for the requested colour format for example. Or the source (the document) hasn't the same format as the target medium.
Both adaptions shouldn't be done by the driver itself. That's the job of the framework.
This file provides the corresponding routines.
#define MONOCHROME0_WHITE 0xff |
No-dot value for CAPS_CF_MONOCHROME0
#define MONOCHROME1_WHITE 0x00 |
No-dot value for CAPS_CF_MONOCHROME1
#define LUMINANCE_WHITE 0xff |
No-dot value for CAPS_CF_GREY
Luminance=0xff => white, e.g. no dot
#define RGB_WHITE 0xff |
No-dot value for CAPS_CF_RGB
Red=0xff, Green=0xff, Blue=0xff => white, e.g. no dot
#define CMYK_WHITE 0x00 |
No-dot value for CAPS_CF_CMYK
Cyan=0, Mangenta=0, Yellow=0, Key=0 => white, e.g. no dot
|
static |
Wipe-out an amount of monochrome dots beginning at the given buffer
[in] | cnt | Amount of dots to wipe-out |
[in,out] | buf | Where to start changing dots |
[in] | nodot | Wipe-out value (0xff or 0x00) |
For CAPS_CF_MONOCHROME0 let val = 0xff, for CAPS_CF_MONOCHROME1 let val = 0x00
|
static |
Wipe-out an amount of dots in the given buffer from right to left
[in] | cnt | Amount of dots to wipe-out |
[in,out] | buf | Where to stop changing dots (e.g. last byte in the buffer) |
[in] | nodot | Wipe-out value (0xff or 0x00) |
For CAPS_CF_MONOCHROME0 let val = 0xff, for CAPS_CF_MONOCHROME1 let val = 0x00
|
static |
Wipe-out an amount of grey dots beginning at the given buffer
[in] | cnt | Amount of dots to wipe-out |
[in,out] | buf | Where to start changing dots |
Uses LUMINANCE_WHITE for each dot
|
static |
Wipe-out an amount of RGB dots beginning at the given buffer
[in] | cnt | Amount of dots to wipe-out |
[in,out] | buf | Where to start changing dots |
Uses RGB_WHITE for all three colour components for each dot
|
static |
Wipe-out an amount of CMYK dots beginning at the given buffer
[in,out] | buf | Where to start changing dots |
[in] | cnt | Amount of dots to wipe-out |
Used CMYK_WHITE for all four colour components for each dot
|
static |
Provide an empty line in the corresponding colour format
[in] | dots_per_line | Dots in the line in the corresponding colour format |
[in,out] | buf | Where the line to be wiped-out starts |
[in] | cf | Colour format |
|
static |
Allocate a line buffer on demand for the emulated colour format
[in] | buf | The current buffer pointer (can be NULL) |
[in] | dots_per_line | Dot count of one line |
[in] | cf | The colour format of the dots to emulate |
buf | If a buffer is already available |
Pointer | A line buffer of the correct length |
If buf is NULL a correct sized buffer is returned. This buffer can be used on further calls as buf again.
|
static |
Poison the line buffer to discover bad margin/offset handling
This is only made when DEBUG is enabled. Let the compiler sort it out if not used
void caps_drv_emulation_stop | ( | struct caps_drv * | cdrv | ) |
Clean up the emulated data
|
static |
Allocate once per page a buffer for the halftone raster
Unless the buffer is freed, no new buffer is allocated, instead the existing one from the previous page is re-used.
|
static |
Read one line from a halftone converter and store it into the emulation raster buffer
[in,out] | buf | The emulation buffer to store the line to (its base address) |
[in] | htc | The halftone converter to read a line from |
[in] | ll | Full line length in buf |
[in] | no | Line number in buf to write the line to |
[in] | expected_width | Expected width in pixel per line (e.g. <= ll ) for error cecking |
[in] | cf | Colour format in which the line should be stored in buf |
buf
is expected to have the size to store an ll
long line at line no
.
|
static |
Dither the input grey scale raster with the given halftone converter
[in,out] | cdrv | libcapsdriver handle |
[in] | htc | Halftone converter to use for the conversion |
When the routine returns, there is a second raster buffer with the requested monochrome data format in caps_drv::mono_buf. It is used as long caps_drv::emulate is one of the monochrome pixel formats instead of CAPS_CF_NONE.
This buffer is created when the first page of a document should be converted and re-used on every next page if possible and freed at the end when emulation is stopped (caps_drv_emulation_stop())
|
static |
Tweak the horizontal position of the monochrome raster
[in,out] | desc | The raster description to tweak |
When we copy the monochrome line into the full line buffer in caps_drv_raster_line_copy_get() we have a little problem with positions which aren't a multiple of eight. Due to the implementation in caps_drv_raster_line_copy_get() the start of the line is exact or up to 7 bits left. These up to 7 bits must be added at the right border to wipe them out.
int caps_drv_emulation_setup | ( | struct caps_drv * | cdrv | ) |
Convert the rasterized image on demand
0 | Always |
For the case, we need to emulate some colour format, we do it here