void *icd = data->iscanceleddata;
char jobid[50];
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
/*
* Open the input data stream specified by the inputfd...
}
/* Find print-rendering-intent */
- getPrintRenderIntent(data, &h);
+ cfGetPrintRenderIntent(data, &h);
if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Print rendering intent = %s", h.cupsRenderingIntent);
}
cspace = icc_profile ? CUPS_CSPACE_RGB : -1;
- cupsRasterPrepareHeader(&h, data, outformat,
+ cfRasterPrepareHeader(&h, data, outformat,
(outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER ?
outformat : CF_FILTER_OUT_FORMAT_CUPS_RASTER), 0,
&cspace);
* Also add job-attrs in options list itself.
*/
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
/*
* Compute custom margins and min_width and min_length of the page...
/* The cfFilterSetCommonOptions() does not set doc.Color
according to option settings (user's demand for color/gray),
so we parse the options and set the mode here */
- cupsRasterParseIPPOptions(&h, data, 0, 1);
+ cfRasterParseIPPOptions(&h, data, 0, 1);
if (doc.Color)
doc.Color = h.cupsNumColors <= 1 ? 0 : 1;
if (!doc.ppd) {
- /* Without PPD use also the other findings of cupsRasterParseIPPOptions() */
+ /* Without PPD use also the other findings of cfRasterParseIPPOptions() */
doc.Orientation = h.Orientation;
doc.Duplex = h.Duplex;
doc.PageWidth = h.cupsPageSize[0] != 0.0 ? h.cupsPageSize[0] :
/* The cfFilterSetCommonOptions() does not set doc.Color
according to option settings (user's demand for color/gray),
so we parse the options and set the mode here */
- cupsRasterParseIPPOptions(&h, data, 0, 1);
+ cfRasterParseIPPOptions(&h, data, 0, 1);
if (doc.Color)
doc.Color = h.cupsNumColors <= 1 ? 0 : 1;
if (!ppd) {
- /* Without PPD use also the other findings of cupsRasterParseIPPOptions() */
+ /* Without PPD use also the other findings of cfRasterParseIPPOptions() */
doc.Orientation = h.Orientation;
doc.Duplex = h.Duplex;
doc.LanguageLevel = 2;
* Option list...
*/
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
/*
* Open the input data stream specified by the inputfd ...
* Process job options...
*/
- cupsRasterPrepareHeader(&header, data, outformat,
+ cfRasterPrepareHeader(&header, data, outformat,
CF_FILTER_OUT_FORMAT_CUPS_RASTER, 1, &cspace);
ppd = data->ppd;
doc.Orientation = header.Orientation;
/* Find print-rendering-intent */
- getPrintRenderIntent(data, &header);
+ cfGetPrintRenderIntent(data, &header);
if(log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Print rendering intent = %s",
header.cupsRenderingIntent);
/* Find print-rendering-intent */
- getPrintRenderIntent(data, &h);
+ cfGetPrintRenderIntent(data, &h);
if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Print rendering intent = %s", h.cupsRenderingIntent);
cupsArrayAdd(mupdf_args, strdup("-Fpwg"));
/* Note that MuPDF only creates PWG Raster and never CUPS Raster,
- so we set the PWG Raster flag in the cupsRasterPrepareHeader() call.
+ so we set the PWG Raster flag in the cfRasterPrepareHeader() call.
This function takes care of generating a completely consistent PWG
Raster header then, no extra manipulation needed.
From the header h only cupsWidth/cupsHeight (dimensions in pixels),
resolution, and color space are used here. */
- cupsRasterPrepareHeader(&h, data, outformat,
+ cfRasterPrepareHeader(&h, data, outformat,
CF_FILTER_OUT_FORMAT_PWG_RASTER, 1, &cspace);
if ((h.HWResolution[0] == 100) && (h.HWResolution[1] == 100)) {
* CUPS option list
*/
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
if (data->ppd)
ppd = data->ppd;
}
}
- cupsRasterPrepareHeader(header, data, outformat, outformat, 0, &cspace);
+ cfRasterPrepareHeader(header, data, outformat, outformat, 0, &cspace);
if (ppd)
{
}
}
} else {
- int backside = getBackSideAndHeaderDuplex(printer_attrs, header);
+ int backside = cfGetBackSideAndHeaderDuplex(printer_attrs, header);
if(header->Duplex){
/* analyze options relevant to Duplex */
/* APDuplexRequiresFlippedMargin */
FM_NO, FM_FALSE, FM_TRUE
} flippedMargin = FM_NO;
- if (backside==BACKSIDE_MANUAL_TUMBLE && header->Tumble)
+ if (backside==CF_BACKSIDE_MANUAL_TUMBLE && header->Tumble)
{
pclmtoraster_data->swap_image_x = pclmtoraster_data->swap_image_y =
true;
pclmtoraster_data->swap_margin_y = false;
}
}
- else if (backside==BACKSIDE_ROTATED && !header->Tumble)
+ else if (backside==CF_BACKSIDE_ROTATED && !header->Tumble)
{
pclmtoraster_data->swap_image_x = pclmtoraster_data->swap_image_y =
true;
pclmtoraster_data->swap_margin_y = false;
}
}
- else if (backside==BACKSIDE_FLIPPED)
+ else if (backside==CF_BACKSIDE_FLIPPED)
{
if (header->Tumble)
{
}
else if(filter_data!=NULL &&(filter_data->printer_attrs)!=NULL)
{
- ippRasterMatchIPPSize(&(data->header), filter_data, margins, paperdimensions, NULL, NULL);
+ cfRasterMatchIPPSize(&(data->header), filter_data, margins, paperdimensions, NULL, NULL);
if (data->outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER)
memset(margins, 0, sizeof(margins));
}
ppd_file_t *ppd = data->ppd;
int num_options = 0;
cups_option_t *options = NULL;
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
if (param.reverse)
// Enable evenDuplex or the first page may be empty.
param.evenDuplex=true; // disabled later, if non-duplex
void *icd = data->iscanceleddata;
int num_options = 0;
cups_option_t *options = NULL;
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
if (parameters)
final_content_type = (char *)parameters;
* CUPS option list
*/
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
ppd = data->ppd;
"cfFilterPDFToPS: No resolution information found in the PPD file.");
}
else{
- cupsRasterParseIPPOptions(&header, data, 0, 1);
+ cfRasterParseIPPOptions(&header, data, 0, 1);
if (header.HWResolution[0] > 100 && header.HWResolution[1] > 100)
{
xres = header.HWResolution[0];
if (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER)
doc->pwgraster = 1;
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
if (data->ppd)
doc->ppd = data->ppd;
if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: PPD file is not specified.");
- cupsRasterPrepareHeader(&(doc->header), data, outformat,
+ cfRasterPrepareHeader(&(doc->header), data, outformat,
(outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ?
outformat : CF_FILTER_OUT_FORMAT_CUPS_RASTER), 0,
&cspace);
else
doc->pwgraster = 0;
}
- getPrintRenderIntent(data, &(doc->header));
+ cfGetPrintRenderIntent(data, &(doc->header));
if(strcasecmp(doc->header.cupsRenderingIntent, "PERCEPTUAL")==0){
doc->colour_profile.renderingIntent = INTENT_PERCEPTUAL;
} else if (strcasecmp(doc->header.cupsRenderingIntent,"RELATIVE") == 0) {
if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Print rendering intent = %s", doc->header.cupsRenderingIntent);
- int backside = getBackSideAndHeaderDuplex(printer_attrs, &(doc->header));
+ int backside = cfGetBackSideAndHeaderDuplex(printer_attrs, &(doc->header));
if (doc->header.Duplex) {
/* analyze options relevant to Duplex */
/* APDuplexRequiresFlippedMargin */
FM_NO, FM_FALSE, FM_TRUE
} flippedMargin = FM_NO;
- if (backside == BACKSIDE_MANUAL_TUMBLE && doc->header.Tumble) {
+ if (backside == CF_BACKSIDE_MANUAL_TUMBLE && doc->header.Tumble) {
doc->swap_image_x = doc->swap_image_y = true;
doc->swap_margin_x = doc->swap_margin_y = true;
if (flippedMargin == FM_TRUE) {
doc->swap_margin_y = false;
}
- } else if (backside==BACKSIDE_ROTATED && !doc->header.Tumble) {
+ } else if (backside==CF_BACKSIDE_ROTATED && !doc->header.Tumble) {
doc->swap_image_x = doc->swap_image_y = true;
doc->swap_margin_x = doc->swap_margin_y = true;
if (flippedMargin == FM_TRUE) {
doc->swap_margin_y = false;
}
- } else if (backside==BACKSIDE_FLIPPED) {
+ } else if (backside==CF_BACKSIDE_FLIPPED) {
if (doc->header.Tumble) {
doc->swap_image_x = true;
doc->swap_margin_x = doc->swap_margin_y = true;
if (doc->pwgraster == 1)
memset(margins, 0, sizeof(margins));
} else if(data!=NULL && (data->printer_attrs)!=NULL) {
- ippRasterMatchIPPSize(&(doc->header), data, margins, paperdimensions, &imageable_area_fit, NULL);
+ cfRasterMatchIPPSize(&(doc->header), data, margins, paperdimensions, &imageable_area_fit, NULL);
if(doc->pwgraster==1){
memset(margins, 0, sizeof(margins));
}
void *ld = data ->logdata;
cups_cspace_t cspace = (cups_cspace_t)(-1);
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
if (data->ppd)
doc->ppd = data->ppd;
// We can directly create CUPS Raster, PWG Raster, and Apple Raster but
// for PCLm we have to output CUPS Raster and feed it into cfFilterRasterToPDF()
- cupsRasterPrepareHeader(&(doc->outheader), data, outformat,
+ cfRasterPrepareHeader(&(doc->outheader), data, outformat,
outformat == CF_FILTER_OUT_FORMAT_PCLM ?
CF_FILTER_OUT_FORMAT_CUPS_RASTER : outformat, 0, &cspace);
*
* Contents:
*
- * cupsRasterParseIPPOptions() - Parse IPP options from the command line
+ * cfRasterParseIPPOptions() - Parse IPP options from the command line
* and apply them to the CUPS Raster header.
*/
/*
- * 'ippRasterMatchIPPSize()' - Match IPP page size to header page size.
+ * 'cfRasterMatchIPPSize()' - Match IPP page size to header page size.
*/
int
-ippRasterMatchIPPSize(
+cfRasterMatchIPPSize(
cups_page_header2_t *header, /* I - Page header to match */
cf_filter_data_t *data, /* I - printer-data file */
double margins[4], /* O - Margins of media in points */
}
/*
- * 'getBackSideAndHeaderDuplex()' -
+ * 'cfGetBackSideAndHeaderDuplex()' -
* This functions returns the cupsBackSide using
* printer attributes.
* meaning and reason for backside orientation:-
*/
int /* O - Backside obtained using printer attributes */
-getBackSideAndHeaderDuplex(ipp_t *printer_attrs, /* I - printer attributes using filter data */
+cfGetBackSideAndHeaderDuplex(ipp_t *printer_attrs, /* I - printer attributes using filter data */
cups_page_header2_t *header) /* O - header */
{
ipp_attribute_t *ipp_attr; /* IPP attribute */
for(i = 0, count = ippGetCount(ipp_attr); i<count;i++){
const char *dm = ippGetString(ipp_attr, i, NULL); /* DM value */
if(!strcasecmp(dm, "DM1")){
- backside = BACKSIDE_NORMAL;
+ backside = CF_BACKSIDE_NORMAL;
break;
}
if(!strcasecmp(dm, "DM2")){
- backside = BACKSIDE_FLIPPED;
+ backside = CF_BACKSIDE_FLIPPED;
break;
}
if(!strcasecmp(dm, "DM3")){
- backside = BACKSIDE_ROTATED;
+ backside = CF_BACKSIDE_ROTATED;
break;
}
if(!strcasecmp(dm, "DM4")){
- backside = BACKSIDE_MANUAL_TUMBLE;
+ backside = CF_BACKSIDE_MANUAL_TUMBLE;
break;
}
}
const char *keyword;
keyword = ippGetString(ipp_attr, 0, NULL);
if (!strcmp(keyword, "flipped"))
- backside = BACKSIDE_FLIPPED;
+ backside = CF_BACKSIDE_FLIPPED;
else if (!strcmp(keyword, "manual-tumble"))
- backside = BACKSIDE_MANUAL_TUMBLE;
+ backside = CF_BACKSIDE_MANUAL_TUMBLE;
else if (!strcmp(keyword, "normal"))
- backside = BACKSIDE_NORMAL;
+ backside = CF_BACKSIDE_NORMAL;
else
- backside = BACKSIDE_ROTATED;
+ backside = CF_BACKSIDE_ROTATED;
}
}
}
- if(header && header->Duplex==1 && backside==-1) backside = BACKSIDE_NORMAL;
+ if(header && header->Duplex==1 && backside==-1) backside = CF_BACKSIDE_NORMAL;
return backside;
}
int
-getPrintRenderIntent(cf_filter_data_t *data,
+cfGetPrintRenderIntent(cf_filter_data_t *data,
cups_page_header2_t *header)
{
const char *val;
cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int i;
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
if ((val = cupsGetOption("print-rendering-intent", num_options,
options)) != NULL ||
}
/*
- * 'cupsRasterPrepareHeader() - This function creates a CUPS/PWG
+ * 'cfRasterPrepareHeader() - This function creates a CUPS/PWG
* Raster header for Raster output based
* on the printer and job properties
* supplied to the calling filter
int /* O - 0 on success,
-1 on error */
-cupsRasterPrepareHeader(cups_page_header2_t *h, /* I - Raster header */
+cfRasterPrepareHeader(cups_page_header2_t *h, /* I - Raster header */
cf_filter_data_t *data, /* I - Job and printer data */
cf_filter_out_format_t final_outformat,
/* I - Job output format
printer_attrs = data->printer_attrs;
job_attrs = data->job_attrs;
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
ppd = data->ppd;
printer_attrs = data->printer_attrs;
job_attrs = data->job_attrs;
log(ld, CF_LOGLEVEL_DEBUG,
"Determining best color space/depth ...");
}
- res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
+ res = cfRasterSetColorSpace(h, cspaces_available, color_mode,
cspace, &hi_depth);
}
}
if (log)
log(ld, CF_LOGLEVEL_DEBUG,
"For PCLm color mode is always SRGB/SGray 8-bit.");
- res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
+ res = cfRasterSetColorSpace(h, cspaces_available, color_mode,
cspace, &hi_depth);
}
}
pwgraster = 0;
}
}
- cupsRasterParseIPPOptions(h, data, 1 - cupsrasterheader, 1);
- if (ippRasterMatchIPPSize(h, data, margins, dimensions, NULL, NULL) < 0) {
+ cfRasterParseIPPOptions(h, data, 1 - cupsrasterheader, 1);
+ if (cfRasterMatchIPPSize(h, data, margins, dimensions, NULL, NULL) < 0) {
for (i = 0; i < 2; i ++)
dimensions[i] = h->PageSize[i];
memset(margins, 0, sizeof(margins));
log(ld, CF_LOGLEVEL_DEBUG,
"Determining best color space/depth ...");
}
- res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
+ res = cfRasterSetColorSpace(h, cspaces_available, color_mode,
cspace, &hi_depth);
}
else if (pclm)
if (log)
log(ld, CF_LOGLEVEL_DEBUG,
"For PCLm color mode is always SRGB/SGray 8-bit.");
- res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
+ res = cfRasterSetColorSpace(h, cspaces_available, color_mode,
cspace, &hi_depth);
}
}
if (res != 1) {
- /* cupsRasterSetColorSpace() was called */
+ /* cfRasterSetColorSpace() was called */
if (res < 0) {
/* failed */
if (log) {
/*
- * 'cupsRasterSetColorSpace() - Update a given CUPS/PWG Raster header to
+ * 'cfRasterSetColorSpace() - Update a given CUPS/PWG Raster header to
* the desired color mode, color space, and
* color depth. We supply one of the printer
* IPP attributes urf-supported or
int /* O - 0 on success,
-1 on error */
-cupsRasterSetColorSpace(cups_page_header2_t *h, /* I - Raster header */
+cfRasterSetColorSpace(cups_page_header2_t *h, /* I - Raster header */
const char *available, /* I - Available color spaces
IPP attribute
urf-supported or
/*
- * 'cupsRasterParseIPPOptions()' - Parse IPP options from the command line
+ * 'cfRasterParseIPPOptions()' - Parse IPP options from the command line
* and apply them to the CUPS Raster header.
*/
int /* O - -1 on error, 0 on success */
-cupsRasterParseIPPOptions(cups_page_header2_t *h, /* I - Raster header */
+cfRasterParseIPPOptions(cups_page_header2_t *h, /* I - Raster header */
cf_filter_data_t *data,
int pwg_raster, /* I - 1 if PWG Raster */
int set_defaults) /* I - If 1, set default
/*
* Join the IPP attributes and the CUPS options in a single list
*/
- num_options = joinJobOptionsAndAttrs(data, num_options, &options);
+ num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options);
/*
* If we have a PPD file in the filter data, take it into account, by
/* Function for storing job-attrs in options */
-int joinJobOptionsAndAttrs(cf_filter_data_t* data, int num_options, cups_option_t **options)
+int cfJoinJobOptionsAndAttrs(cf_filter_data_t* data, int num_options, cups_option_t **options)
{
ipp_t *job_attrs = data->job_attrs; /* Job attributes */
ipp_attribute_t *ipp_attr; /* IPP attribute */
/*
- * CUPS/PWG Raster utilities header file for CUPS.
+ * CUPS/PWG Raster utilities header file for cups-filters.
*
* Copyright 2013 by Till Kamppeter.
*
* Types
*/
-typedef enum backside_orient_e
+typedef enum cf_backside_orient_e
{
- BACKSIDE_MANUAL_TUMBLE,
- BACKSIDE_ROTATED,
- BACKSIDE_FLIPPED,
- BACKSIDE_NORMAL
-} backside_orient_t;
+ CF_BACKSIDE_MANUAL_TUMBLE,
+ CF_BACKSIDE_ROTATED,
+ CF_BACKSIDE_FLIPPED,
+ CF_BACKSIDE_NORMAL
+} cf_backside_orient_t;
/*
* Prototypes...
*/
-extern int cupsRasterPrepareHeader(cups_page_header2_t *h,
- cf_filter_data_t *data,
- cf_filter_out_format_t
- final_outformat,
- cf_filter_out_format_t
- header_outformat,
- int no_hig_depth,
- cups_cspace_t *cspace);
-extern int cupsRasterSetColorSpace(cups_page_header2_t *h,
- const char *available,
- const char *color_mode,
- cups_cspace_t *cspace,
- int *high_depth);
-extern int cupsRasterParseIPPOptions(cups_page_header2_t *h,
- cf_filter_data_t *data,
- int pwg_raster,
- int set_defaults);
-extern int joinJobOptionsAndAttrs(cf_filter_data_t *data,
- int num_options,
- cups_option_t **options);
-extern int ippRasterMatchIPPSize(cups_page_header2_t *header,
+extern int cfRasterPrepareHeader(cups_page_header2_t *h,
cf_filter_data_t *data,
- double margins[4],
- double dimensions[2],
- int *image_fit,
- int *landscape);
-extern int getBackSideAndHeaderDuplex(ipp_t *printer_attrs,
- cups_page_header2_t *header);
-
-extern int getPrintRenderIntent(cf_filter_data_t *data,
- cups_page_header2_t *header);
+ cf_filter_out_format_t
+ final_outformat,
+ cf_filter_out_format_t
+ header_outformat,
+ int no_hig_depth,
+ cups_cspace_t *cspace);
+extern int cfRasterSetColorSpace(cups_page_header2_t *h,
+ const char *available,
+ const char *color_mode,
+ cups_cspace_t *cspace,
+ int *high_depth);
+extern int cfRasterParseIPPOptions(cups_page_header2_t *h,
+ cf_filter_data_t *data,
+ int pwg_raster,
+ int set_defaults);
+extern int cfJoinJobOptionsAndAttrs(cf_filter_data_t *data,
+ int num_options,
+ cups_option_t **options);
+extern int cfRasterMatchIPPSize(cups_page_header2_t *header,
+ cf_filter_data_t *data,
+ double margins[4],
+ double dimensions[2],
+ int *image_fit,
+ int *landscape);
+extern int cfGetBackSideAndHeaderDuplex(ipp_t *printer_attrs,
+ cups_page_header2_t
+ *header);
+extern int cfGetPrintRenderIntent(cf_filter_data_t *data,
+ cups_page_header2_t *header);
# ifdef __cplusplus
}
/*
* End
*/
-
log, ld);
if (!data->ppd) {
- cupsRasterParseIPPOptions(&(doc.h), data, 0, 1);
+ cfRasterParseIPPOptions(&(doc.h), data, 0, 1);
doc.Orientation = doc.h.Orientation;
doc.Duplex = doc.h.Duplex;
doc.ColorDevice = doc.h.cupsNumColors <= 1 ? 0 : 1;