Skip to content

Commit 3d28a44

Browse files
committed
libcupsfilters: In cupsRasterPrepareHeader() added monchrome PCLm support
PCLm supports exactly 2 color spaces, sRGB 8-bit for color and sGray 8-bit for monochrome printing. Up to now we only had supported the sRGB space. This commit adds support for sGray. This especially allows monchrome printing on color PCLm printers, and faster (less data to handle) and more economic (use only black toner/ink, not the colored ones) grayscale printing. Principally all PCLm printers should support both color spaces.
1 parent df3b197 commit 3d28a44

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

cupsfilters/raster.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,20 @@ cupsRasterPrepareHeader(cups_page_header2_t *h, /* I - Raster header */
743743
}
744744
else if (pclm)
745745
{
746-
/* Color space is always SRGB 8 */
747-
cspaces_available = "srgb_8";
748-
color_mode = "auto";
746+
/* Available color spaces are always SRGB 8 and SGray 8 */
747+
cspaces_available = "srgb_8,sgray_8";
748+
if ((color_mode = cupsGetOption("print-color-mode", num_options,
749+
options)) == NULL) {
750+
choice = ppdFindMarkedChoice(ppd, "ColorModel");
751+
if (choice)
752+
color_mode = choice->choice;
753+
else
754+
color_mode = "auto";
755+
}
749756
hi_depth = 0;
750757
if (log)
751758
log(ld, FILTER_LOGLEVEL_DEBUG,
752-
"For PCLm color mode is always SRGB 8-bit.");
759+
"For PCLm color mode is always SRGB/SGray 8-bit.");
753760
res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
754761
cspace, &hi_depth);
755762
}
@@ -830,13 +837,16 @@ cupsRasterPrepareHeader(cups_page_header2_t *h, /* I - Raster header */
830837
}
831838
else if (pclm)
832839
{
833-
/* Color space is always SRGB 8 */
834-
cspaces_available = "srgb_8";
835-
color_mode = "auto";
840+
/* Available color spaces are always SRGB 8 and SGray 8 */
841+
cspaces_available = "srgb_8,sgray_8";
842+
if ((color_mode = cupsGetOption("print-color-mode", num_options,
843+
options)) == NULL)
844+
color_mode = ippAttrEnumValForPrinter(printer_attrs, job_attrs,
845+
"print-color-mode");
836846
hi_depth = 0;
837847
if (log)
838848
log(ld, FILTER_LOGLEVEL_DEBUG,
839-
"For PCLm color mode is always SRGB 8-bit.");
849+
"For PCLm color mode is always SRGB/SGray 8-bit.");
840850
res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
841851
cspace, &hi_depth);
842852
}

0 commit comments

Comments
 (0)