CAPS Universe documentation  1.0.4
All you need to know to be successful
Data Structures | Functions
Get the raw rasterized dot data to print

Reading the raw raster line by line for your own processing. More...

Data Structures

struct  caps_drv_raw_raster
 Raw raster information for full medium raster reconstruction. More...
 

Functions

int caps_drv_raw_raster_info_get (struct caps_drv *cdrv, struct caps_drv_raw_raster *rr)
 
const void * caps_drv_raw_raster_line_get (struct caps_drv *cdrv, unsigned line_no)
 

Detailed Description

All these functions hide the details of libcapsraster behind. You can call them in the caps_generic_driver::page_print callback.

In the caps_generic_driver::page_print callback you get access to a raw raster which covers only a part of the medium size you have set in the caps_generic_driver::page_setup's callback via caps_drv_print_medium_size_set(). Since the raw raster size depends on the printable area and the print resolution you always need the following functions to retrieve this information from the library.

Left: full medium raster Right: raw raster

The raw raster is most of the time smaller than the medium size, but can be as large as the medium size as well. You always need to consider the caps_drv_raw_raster::skipped_top_lines and caps_drv_raw_raster::skipped_left_dots members. These members can be zero!

Note
The raw raster is never larger than the medium size.

If your printer is able to optimize empty areas in some manner, this API could help to detect the area where real data has to be printed.

Another use case is a printer which has hardware dependent margins and the first dot to be sent must be the first one to be printed (e.g. the dots in the hardware margin must be skipped).

Function Documentation

◆ caps_drv_raw_raster_info_get()

int caps_drv_raw_raster_info_get ( struct caps_drv cdrv,
struct caps_drv_raw_raster rr 
)

Get the information how to reconstruct the full medium raster from the raw raster

Parameters
[in]cdrvlibcapsdriver handle
[out]rrRaw raster information
Return values
0*rr contains the requested information
-EINVALNo raster information available

The returned raw raster information is intended to be used to reconstruct the full medium raster according to the following image:

Raw raster to full medium raster reconstruction

Access to the raw raster must be made through caps_drv_raw_raster_line_get()

Note
This is a wrapper around libcapsraster

◆ caps_drv_raw_raster_line_get()

const void * caps_drv_raw_raster_line_get ( struct caps_drv cdrv,
unsigned  line_no 
)

Get a pointer to a line of dots into the raw raster data

Parameters
[in]cdrvlibcapsdriver handle
[in]line_noRaster line number to return a pointer to
Returns
Pointer into the raw raster data according to the requested line in line_no
Attention
The returned pointer points into raw raster data. This data should not be changed in any way nor the returned address freed after use.

The line contains the dot count of the raw raster data. This dot count might cover the imageable area you have defined in caps_drv_print_medium_size_set(). But can also be much smaller, if the document defines a smaller page.

Note
The line length is caps_drv_raw_raster::line_length bytes, contains caps_drv_raw_raster::width dots and the size of each dot depends on the caps_drv_raw_raster::cf mode.
Refer caps_drv_raw_raster for details.
Precondition
Can be called in the caps_generic_driver::page_print callback
Note
This is a wrapper around caps_rstr_line_get()