📄 pclgen.h
字号:
#endif /* TRUE == 0 */#endif /* TRUE *//* Palette (process colour model) */typedef enum { pcl_no_palette, /* Don't send Number of Planes per Row */ pcl_black, pcl_CMY, pcl_CMYK, pcl_RGB, /* Using the RGB palette is discouraged by HP. */ pcl_any_palette /* Don't use this value unless you know what you are doing. */} pcl_Palette;/* Information per colorant for raster images */typedef struct { unsigned int hres, vres; /* Resolution in ppi. The orientation refers to raster space. Both values must be non-zero. */ unsigned int levels; /* Number of intensity levels. 2 or larger. */} pcl_ColorantState;/*****************************************************************************//* 'pcl_Octet' is used to store 8-bit bytes as unsigned numbers. */#ifndef _pcl_Octet_defined#define _pcl_Octet_definedtypedef unsigned char pcl_Octet;#endif/* Octet strings */typedef struct { pcl_Octet *str; /* Data area for storing the octet string. */ int length; /* Length of 'str' in octets (non-negative). */} pcl_OctetString;/* A "valid" pcl_OctetString is one where either 'length' is zero, or 'length' is positive and 'str' is non-NULL and points to a storage area of at least 'length' octets. A "zero" pcl_OctetString is one where 'length' is zero.*//*****************************************************************************//* File-global data */typedef struct { pcl_Level level; /* Printer initialization */ int NULs_to_send; char *PJL_job, /* PJL job name. Ignored if NULL. */ *PJL_language; /* PJL personality. Ignored if NULL. */ /* Additional initialization commands (ignored if zero) */ pcl_OctetString init1, /* send immediately after resetting the printer */ init2; /* send after all other initialization commands */ /* Media */ pcl_PageSize size; int media_type, media_source, /* 0: don't request a particular media source */ media_destination, /* 0: don't request a particular media destination. Not based on HP documentation. */ duplex; /* -1: don't request anything in this respect, 0: simplex, 1: duplex long-edge binding, 2: duplex short-edge binding (BPL02705). I assume the correct interpretation of the duplex values to be: 1: duplex, print back side with the same top edge in raster space 2: duplex, print back side with top and bottom edges exchanged in raster space */ pcl_bool manual_feed; /* Print quality selection. Which of these variables are used depends on the PCL level chosen. */ int print_quality, depletion, /* 0: no depletion command */ shingling, raster_graphics_quality; /* Colour information */ pcl_Palette palette; unsigned int number_of_colorants; pcl_ColorantState *colorant; /* This variable must either be NULL or point to an array of at least 'number_of_colorants' elements. The order of colorants is (K)(CMY) except for 'pcl_any_palette'. If the pointer is NULL, 'colorant_array' is used instead. */ pcl_ColorantState colorant_array[4]; /* Used if 'colorant' is NULL and with the same meaning. This is only possible if 'number_of_colorants' is at most 4. */ pcl_bool order_CMYK; /* For pcl_CMYK, should the order of bit planes when sent to the printer be reversed to CMYK instead of KCMY? This is not standard PCL but is needed by at least one Olivetti printer (Olivetti JP792). */ int dry_time; /* negative for "don't send this command" */ pcl_Compression compression; /* Derived information managed by the routines declared here. These fields have reliable values only after a call to plc3_init_file(). */ unsigned short number_of_bitplanes; unsigned short black_planes; unsigned int minvres; /* minimal vertical resolution */} pcl_FileData;/*****************************************************************************//* Types for raster data */typedef struct { /* Data to be provided by the caller */ unsigned int width; /* maximal length of raster lines in pixels at the lowest horizontal resolution. This may be zero to indicate "as large as possible", but this could waste printer memory. Always set this when using an RGB palette unless you have reliable data on the clipping boundary. The value should probably always be a multiple of 8. */ pcl_FileData *global; /* must point to the data used in the last call to pcl3_init_file() */ pcl_OctetString *previous, *next; /* These variables point to the sequences of bit planes for the old and the new strip group. The total number of bit planes per group can be obtained in the 'number_of_bitplanes' parameter in '*global'. The order of bit planes within a strip group is as follows: - Each strip group consists of a number of "colorant strips", one for each colorant. All strips in such a group cover the same region on the page. Except for 'pcl_RGB', colorant strips are ordered in the sequence (K)(CMY), independent of 'order_CMYK'. For an RGB palette, the order is (of course) RGB. - Each colorant strip contains a number of pixel lines for this colorant. If there is more than one line, the lines are ordered from top to bottom as seen from raster space. The number of lines is the ratio of that colorant's vertical resolution to the smallest vertical resolution. - Within each pixel line for a colorant, bit planes are ordered from least to most significant. The number of bit planes within a line is pcl3_levels_to_planes(levels) for this colorant. When bit planes are again combined into lines for a particular colorant, the resulting value per pixel denotes the intensity for that colorant. A value of zero denotes absence of that colorant. 'previous' will be ignored (and may then be NULL) unless a differential compression method is requested (pcl_cm_is_differential()). When using an RGB palette you should always send bit planes extending over the whole 'width' because shorter bit planes are implicitly extended with null octets and a pixel value of zero denotes black in an RGB palette which is not usually desired. */ pcl_Octet *workspace[2]; /* Storage for the use of these routines. workspace[0] must be non-NULL, workspace[1] will be ignored except for Delta Row Compression. */ size_t workspace_allocated; /* Length allocated for each non-NULL 'workspace[]'. This should be at least 2 larger than the longest possible bit plane, otherwise raster data might have to be sent in uncompressed form even if that would take more space. */ /* Internal data for these routines */ pcl_Compression current_compression; /* last compression method used */ pcl_OctetString **seed_plane; /* seed plane indexed by plane index */} pcl_RasterData;/****************************************************************************** The routines assume a simple state machine: - You are either on a page or between pages. - If you are on a page, you are either in raster mode or not. You should call pcl3_init_file() before the first page and between pages whenever you change the file-global data (like the resolution). Otherwise, use the ..._begin() and ..._end() functions to navigate between the states. Look into the implementation file for detailed interface descriptions for these routines. The error conventions are the same for all file, page and raster functions: - A return code of zero indicates success. - A positive return code indicates an argument error. This should be avoidable by careful programming. - A negative return code indicates an environment error (e.g., disk overflow). If a function returns with a non-zero code, an error message will have been issued on standard error.******************************************************************************//* Auxiliary functions */extern unsigned int pcl3_levels_to_planes(unsigned int levels);extern int pcl3_set_printquality(pcl_FileData *data, int quality);extern int pcl3_set_mediatype(pcl_FileData *data, int mediatype);extern int pcl3_set_oldquality(pcl_FileData *data);extern int pcl_compress(pcl_Compression method, const pcl_OctetString *in, const pcl_OctetString *prev, pcl_OctetString *out);/* File and page functions */extern int pcl3_init_file(FILE *out, pcl_FileData *global);extern int pcl3_begin_page(FILE *out, pcl_FileData *global);extern int pcl3_end_page(FILE *out, pcl_FileData *global);extern int pcl3_end_file(FILE *out, pcl_FileData *global);/* Raster functions */extern int pcl3_begin_raster(FILE *out, pcl_RasterData *data);extern int pcl3_skip_groups(FILE *out, pcl_RasterData *data, unsigned int count);extern int pcl3_transfer_group(FILE *out, pcl_RasterData *data);extern int pcl3_end_raster(FILE *out, pcl_RasterData *data);/*****************************************************************************/#endif /* Inclusion protection */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -