CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Callbacks of one rasterizer. More...
Data Fields | |
const char * | name |
enum rstr_tweaks | tweaks |
int(* | init )(struct caps_rasterizer *rstr) |
int(* | job_start )(struct caps_rasterizer *rstr, unsigned *pcnt) |
int(* | page_next )(struct caps_rasterizer *rstr) |
int(* | page_render )(struct caps_rasterizer *rstr, const struct caps_rstr_page *page_conf, struct raster_adapt_preparation *raster_conf) |
int(* | page_image_get )(struct caps_rasterizer *rstr, struct caps_rstr_raster *desc) |
const void *(* | line_get )(struct caps_rasterizer *rstr, const struct caps_rstr_raster *desc, unsigned line_no) |
void(* | job_end )(struct caps_rasterizer *rstr) |
int(* | exit )(struct caps_rasterizer *rstr) |
These callbacks are valid for all document formats. The framework (e.g. libcapsraster) will call these functions for processing a given document.
const char* name |
Name/description of this rasterizer
enum rstr_tweaks tweaks |
Tweaks for special rasterizer requirements or behaviour
If the bit RSTRS_INHERIT_FILEDESC is set, the rasterizer requires to convert the given filedescriptor in document_desc::fh to something different to deal with its library (for stream IO for example). In this case the rasterizer needs to close the filedescriptor by itself. As an alternative you can set document_desc::fh to '-1' instead. The framework won't touch it anymore in this case.
If RSTRS_INHERIT_FILEDESC isn't set, the framework will close the document_desc::fh by itself at the end of the job.
int(* init) (struct caps_rasterizer *rstr) |
Called once per job to allocate recources and use the already open document file descriptor in a rasterizer's manner to gain access to the document content (for instance refer RSTRS_INHERIT_FILEDESC).
int(* job_start) (struct caps_rasterizer *rstr, unsigned *pcnt) |
Called after init and once per job to extract document infos. The most important info is the page count of the document to be stored in pcnt
and the limits for this rasterize to stored in caps_rasterizer::limits.
int(* page_next) (struct caps_rasterizer *rstr) |
Called to move to the next page in the document
document_desc::pg_desc needs to be filled here, members, caps_rstr_page_desc::medium_sz, caps_rstr_page_desc::printing_area and caps_rstr_page_desc::printing_sz. The goal is to let the framework have an idea about the raster to print
int(* page_render) (struct caps_rasterizer *rstr, const struct caps_rstr_page *page_conf, struct raster_adapt_preparation *raster_conf) |
Called to rasterize the current page
int(* page_image_get) (struct caps_rasterizer *rstr, struct caps_rstr_raster *desc) |
Called to get the rasterized page image
Now it is possible to acces the raster data via line_get
const void *(* line_get) (struct caps_rasterizer *rstr, const struct caps_rstr_raster *desc, unsigned line_no) |
Called to get a pointer to the line in question in the rasterized page image
The line_no
parameter can be of random access and the returned pointer is valid until job_end or exit is called
Depending on the selected rasterizer (e.g. document format) it can be possible, the first dot in the line is not exact. In this case, there are always more dots, never less than intended.
void(* job_end) (struct caps_rasterizer *rstr) |
Called once at the end of the job to finish job processing
After this call, no access to any kind of raster data is possible anymore
int(* exit) (struct caps_rasterizer *rstr) |
Called once at job end to free allocated recources
It is always called, even if init has failed