kviewshell
DjVuToPS Class Reference
DjVuImage to PostScript converter. More...
#include <DjVuToPS.h>
Classes | |
class | Options |
DjVuToPS options. More... | |
Public Types | |
enum | Stage { DECODING, PRINTING } |
Public Member Functions | |
DjVuToPS (void) | |
void | print (ByteStream &, GP< DjVuDocument > doc) |
void | print (ByteStream &, GP< DjVuDocument > doc, GUTF8String page_range) |
void | print (ByteStream &, GP< DjVuImage > dimg, const GRect &prn_rect, const GRect &img_rect, int override_dpi=-1) |
Callbacks | |
void | set_dec_progress_cb (void(*cb)(double, void *), void *data) |
void | set_info_cb (void(*cb)(int, int, int, Stage, void *), void *data) |
void | set_prn_progress_cb (void(*cb)(double, void *), void *data) |
void | set_refresh_cb (void(*refresh_cb)(void *), void *refresh_cl_data) |
Public Attributes | |
Options | options |
Protected Member Functions | |
GP< DjVuImage > | decode_page (GP< DjVuDocument >, int, int, int) |
void | make_gamma_ramp (GP< DjVuImage >) |
void | parse_range (GP< DjVuDocument >, GUTF8String, GList< int > &) |
void | print_bg (ByteStream &, GP< DjVuImage >, const GRect &) |
void | print_fg (ByteStream &, GP< DjVuImage >, const GRect &) |
void | print_fg_2layer (ByteStream &, GP< DjVuImage >, const GRect &, unsigned char *) |
void | print_fg_3layer (ByteStream &, GP< DjVuImage >, const GRect &, unsigned char *) |
void | print_image (ByteStream &, GP< DjVuImage >, const GRect &, GP< DjVuTXT >) |
void | print_image_lev1 (ByteStream &, GP< DjVuImage >, const GRect &) |
void | print_image_lev2 (ByteStream &, GP< DjVuImage >, const GRect &) |
void | process_double_page (ByteStream &, GP< DjVuDocument >, void *, int, int) |
void | process_single_page (ByteStream &, GP< DjVuDocument >, int, int, int, int) |
void | store_doc_prolog (ByteStream &, int, int, GRect *) |
void | store_doc_setup (ByteStream &) |
void | store_doc_trailer (ByteStream &) |
void | store_page_setup (ByteStream &, int, const GRect &, int align=0) |
void | store_page_trailer (ByteStream &) |
Detailed Description
DjVuImage to PostScript converter.Use this class to print {DjVuImage}s and {DjVuDocument}s. The behavior is customizable. See {DjVuToPS::Options} for the description of available options.
Definition at line 95 of file DjVuToPS.h.
Member Enumeration Documentation
enum DjVuToPS::Stage |
Describes current page processing stage.
This is passed to the info_cb()# callback. See {set_info_cb}() for details.
Definition at line 259 of file DjVuToPS.h.
Constructor & Destructor Documentation
DjVuToPS::DjVuToPS | ( | void | ) |
Member Function Documentation
GP< DjVuImage > DjVuToPS::decode_page | ( | GP< DjVuDocument > | doc, | |
int | page_num, | |||
int | cnt, | |||
int | todo | |||
) | [protected] |
Definition at line 2303 of file DjVuToPS.cpp.
Definition at line 903 of file DjVuToPS.cpp.
void DjVuToPS::parse_range | ( | GP< DjVuDocument > | doc, | |
GUTF8String | page_range, | |||
GList< int > & | pages_todo | |||
) | [protected] |
Definition at line 2122 of file DjVuToPS.cpp.
void DjVuToPS::print | ( | ByteStream & | str, | |
GP< DjVuDocument > | doc | |||
) |
Definition at line 2568 of file DjVuToPS.cpp.
void DjVuToPS::print | ( | ByteStream & | str, | |
GP< DjVuDocument > | doc, | |||
GUTF8String | page_range | |||
) |
Outputs the specifies pages from the {DjVuDocument} into the {ByteStream} in PostScript format.
The function will generate a multipage PostScript document conforming to PS DSC 3.0 by storing into it every page mentioned in the page_range#.
If page_range# is empty, all pages from the {DjVuDocument} doc# will be printed. The page_range# is a set of ranges separated by commas. Every range has this form: {start_page}[-{end_page}]. {end_page} is optional and can be less than the {start_page}, in which case the pages will be printed in the reverse order.
Examples: {itemize} { 1-10} - Will print pages 1 to 10. { 10-1} - Will print pages 1 to 10 in reverse order. { 1-10,12-20} - Will print pages 1 to 20 with page 11 skipped. {itemize}
Definition at line 2490 of file DjVuToPS.cpp.
void DjVuToPS::print | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | prn_rect, | |||
const GRect & | img_rect, | |||
int | override_dpi = -1 | |||
) |
Prints the specified {DjVuImage} dimg# into the {ByteStream} str#.
The function will first scale the image to fit the img_rect#, then extract prn_rect# from the obtained bitmap and will output it in the PostScript format. The function generates a legal PostScript (or Encapsulated PostScript) file taking care of all comments conforming to Document Structure Conventions v. 3.0.
{ Warning:} The zoom factor specified in {Options} does not affect the amount of data stored into the PostScript file. It will be used by the PostScript code to additionally scale the image. We cannot pre-scale it here, because we do not know the future resolution of the printer. The img_rect# and prn_rect# alone define how much data will be sent to printer.
Using img_rect# one can upsample or downsample the image prior to sending it to the printer.
- Parameters:
-
str {ByteStream} where PostScript output will be sent dimg {DjVuImage} to print img_rect Rectangle to which the {DjVuImage} will be scaled. Note that this parameters defines the amount of data that will actually be sent to the printer. The PostScript code can futher resize the image according to the zoom# parameter from the {Options} structure. prn_rect Part of img_rect to send to printer. override_dpi Optional parameter allowing you to override dpi setting that would otherwise be extracted from dimg#
Definition at line 2072 of file DjVuToPS.cpp.
void DjVuToPS::print_bg | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | cprn_rect | |||
) | [protected] |
Definition at line 1251 of file DjVuToPS.cpp.
void DjVuToPS::print_fg | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | prn_rect | |||
) | [protected] |
Definition at line 1109 of file DjVuToPS.cpp.
void DjVuToPS::print_fg_2layer | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | prn_rect, | |||
unsigned char * | blit_list | |||
) | [protected] |
Definition at line 931 of file DjVuToPS.cpp.
void DjVuToPS::print_fg_3layer | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | cprn_rect, | |||
unsigned char * | blit_list | |||
) | [protected] |
Definition at line 982 of file DjVuToPS.cpp.
void DjVuToPS::print_image | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | prn_rect, | |||
GP< DjVuTXT > | txt | |||
) | [protected] |
Definition at line 1997 of file DjVuToPS.cpp.
void DjVuToPS::print_image_lev1 | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | prn_rect | |||
) | [protected] |
Definition at line 1453 of file DjVuToPS.cpp.
void DjVuToPS::print_image_lev2 | ( | ByteStream & | str, | |
GP< DjVuImage > | dimg, | |||
const GRect & | prn_rect | |||
) | [protected] |
Definition at line 1640 of file DjVuToPS.cpp.
void DjVuToPS::process_double_page | ( | ByteStream & | str, | |
GP< DjVuDocument > | doc, | |||
void * | v, | |||
int | cnt, | |||
int | todo | |||
) | [protected] |
Definition at line 2399 of file DjVuToPS.cpp.
void DjVuToPS::process_single_page | ( | ByteStream & | str, | |
GP< DjVuDocument > | doc, | |||
int | page_num, | |||
int | cnt, | |||
int | todo, | |||
int | magic | |||
) | [protected] |
Definition at line 2363 of file DjVuToPS.cpp.
void DjVuToPS::set_dec_progress_cb | ( | void(*)(double, void *) | cb, | |
void * | data | |||
) |
Callback used to report the progress of decoding.
The progress is a double number from 0 to 1. This callback is only used when printing a {DjVuDocument} in a multithreaded environment. In all other cases it will not be called. Whenever you {print}() a page range from a {DjVuDocument}, the DjVuToPS# has to decode the mentioned pages before writing them to the output {ByteStream}. This callback can be helpful to find out the status of the decoding. See {set_prn_progress_cb}() to find out how to learn the printing progress. See {set_info_cb}() to learn how to find out the number of the page being processed, the total number of pages and the number of processed pages.
- Parameters:
-
cb Callback function to be called data Pointer passed to cb()#.
Definition at line 2285 of file DjVuToPS.cpp.
void DjVuToPS::set_info_cb | ( | void(*)(int, int, int, Stage, void *) | cb, | |
void * | data | |||
) |
Callback used to report the current printing stage of a {DjVuDocument}.
When printing a {DjVuDocument} ({ not} a {DjVuImage}), the DjVuToPS# class will decode and output every page mentioned in the {page range}. Before decoding and outputing, it will call this info_cb()# callback in order to let you know about what is going on. This can be quite useful in a GUI program to keep the user informed. This function is not called when you print a {DjVuImage}.
Description of the arguments passed to info_cb#: {description} [page_num] The number of the page being processed [page_cnt] Counts how many pages have already been processed. [tot_pages] Counts how many pages will be output enventually. [stage] Describes the current processing stage (DECODING# or PRINTING#). {description}
- Parameters:
-
cb Callback function to be called data Pointer, which will be passed to cb()#.
Definition at line 2294 of file DjVuToPS.cpp.
void DjVuToPS::set_prn_progress_cb | ( | void(*)(double, void *) | cb, | |
void * | data | |||
) |
Callback used to report the progress of printing.
The progress is a double number from 0 to 1. If an existing {DjVuImage} is printed, this callback will be called at least twice: in the beginning and at the end of printing. If a {DjVuDocument} is being printed, this callback will be used to report printing progress of every page. To learn the number of the page being printed you can use {set_info_cb}() function. See {set_dec_progress_cb}() to find out how to learn the decoding progress.
- Parameters:
-
cb Callback function to be called data Pointer passed to cb()#.
Definition at line 2276 of file DjVuToPS.cpp.
void DjVuToPS::set_refresh_cb | ( | void(*)(void *) | refresh_cb, | |
void * | refresh_cl_data | |||
) |
Refresh callback is a function, which will be called fairly often while the image (document) is being printed.
It can be used to refresh a GUI, if necessary.
- Parameters:
-
refresh_cb Callback function to be called periodically refresh_cl_data Pointer passed to refresh_cb()#
Definition at line 2268 of file DjVuToPS.cpp.
void DjVuToPS::store_doc_prolog | ( | ByteStream & | str, | |
int | pages, | |||
int | dpi, | |||
GRect * | grect | |||
) | [protected] |
Definition at line 309 of file DjVuToPS.cpp.
void DjVuToPS::store_doc_setup | ( | ByteStream & | str | ) | [protected] |
Definition at line 390 of file DjVuToPS.cpp.
void DjVuToPS::store_doc_trailer | ( | ByteStream & | str | ) | [protected] |
Definition at line 545 of file DjVuToPS.cpp.
void DjVuToPS::store_page_setup | ( | ByteStream & | str, | |
int | dpi, | |||
const GRect & | grect, | |||
int | align = 0 | |||
) | [protected] |
Definition at line 662 of file DjVuToPS.cpp.
void DjVuToPS::store_page_trailer | ( | ByteStream & | str | ) | [protected] |
Definition at line 798 of file DjVuToPS.cpp.
Member Data Documentation
Options affecting the print result.
Please refer to {DjVuToPS::Options} for details.
Definition at line 294 of file DjVuToPS.h.
The documentation for this class was generated from the following files: