diff --git a/configure.ac b/configure.ac index bdec0ec..ec9c8ae 100644 --- a/configure.ac +++ b/configure.ac @@ -19,11 +19,11 @@ AC_CHECK_PROG(HAVE_CUPSCONFIG, cups-config, 1) AC_CHECK_LIB(cups, ppdOpenFile) #-lcupsdriver for cups < ver 1.6 -AC_SEARCH_LIBS(cupsDitherNew, cupsdriver cupsfilters) -if test "$ac_cv_search_cupsDitherNew" = "-lcupsdriver"; then : +AC_SEARCH_LIBS(cfDitherNew, cupsdriver cupsfilters) +if test "$ac_cv_search_cfDitherNew" = "-lcupsdriver"; then : HAVE_LIBCUPSDRIVER="1" fi -if test "$ac_cv_search_cupsDitherNew" = "-lcupsfilters"; then : +if test "$ac_cv_search_cfDitherNew" = "-lcupsfilters"; then : HAVE_LIBCUPSFILTERS="1" fi @@ -40,6 +40,8 @@ fi AC_SEARCH_LIBS(jbg85_enc_init, jbig85 jbig) JBIG85LIB=$ac_cv_search_jbg85_enc_init +AC_SEARCH_LIBS(ppdCMYKLoad, ppd) + # Checks for header files. AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h cups/raster.h cups/sidechannel.h]) AC_CHECK_HEADERS([cups/image.h cups/driver.h]) diff --git a/src/c2esp.c b/src/c2esp.c index 2e73310..cc614bf 100644 --- a/src/c2esp.c +++ b/src/c2esp.c @@ -44,6 +44,7 @@ If you want to compile with the DEBUGFILES or TESTING options, they should be se #if HAVE_CUPSFILTERS_DRIVER_H == 1 #include //has the dither functions +#include //has ppdCMYKLoad() #else #include //has the dither functions #endif @@ -522,7 +523,7 @@ void PrintOneStripe (unsigned char *buf, int Stripe, int StripeHeight, cups_page } //end of stripe with print } -void SetUpDither(cups_lut_t *Lut[], cups_dither_t *DitherState[], int LineWidth, int OutBits) +void SetUpDither(cf_lut_t *Lut[], cf_dither_t *DitherState[], int LineWidth, int OutBits) { //Creates Luts and DitherStates for dithering @@ -530,14 +531,14 @@ void SetUpDither(cups_lut_t *Lut[], cups_dither_t *DitherState[], int LineWidth, for(Col=0;Col<3;++Col) { //For CMY or RGB - if(OutBits == 2) Lut[Col] = cupsLutNew(3, default_lut3); - else Lut[Col] = cupsLutNew(2, default_lut2); - DitherState[Col] = cupsDitherNew(LineWidth); + if(OutBits == 2) Lut[Col] = cfLutNew(3, default_lut3, NULL, NULL); + else Lut[Col] = cfLutNew(2, default_lut2, NULL, NULL); + DitherState[Col] = cfDitherNew(LineWidth); } //For Kk - if(OutBits == 2) Lut[3] = cupsLutNew(5, default_lut5); - else Lut[3] = cupsLutNew(3, default_lut3); - DitherState[3] = cupsDitherNew(LineWidth); + if(OutBits == 2) Lut[3] = cfLutNew(5, default_lut5, NULL, NULL); + else Lut[3] = cfLutNew(3, default_lut3, NULL, NULL); + DitherState[3] = cfDitherNew(LineWidth); } unsigned char Dithered8ToPrint(unsigned char *Buffer, int x, int Level) @@ -672,7 +673,7 @@ void LetAllRead(char *Fname) void -Terminate(cups_raster_t *ras,int fd,cups_dither_t **DitherState,cups_lut_t **Lut) +Terminate(cups_raster_t *ras,int fd,cf_dither_t **DitherState,cf_lut_t **Lut) { int CloseError, Col; @@ -691,8 +692,8 @@ int CloseError, Col; //free the dither states for(Col = 0; Col < 4 ;++Col) { - cupsDitherDelete(DitherState[Col]); - cupsLutDelete(Lut[Col]); + cfDitherDelete(DitherState[Col]); + cfLutDelete(Lut[Col]); } /* * Termination, send an error message if required... @@ -782,7 +783,7 @@ SaveDitherOut(cups_page_header2_t *header, int Col, int BlankColour,FILE *Dither } } -void DitherProcess(cups_lut_t **Lut, cups_dither_t **DitherState, cups_page_header2_t *header, int Col, int *BlankColour) +void DitherProcess(cf_lut_t **Lut, cf_dither_t **DitherState, cups_page_header2_t *header, int Col, int *BlankColour) { //convert the bits in CupsLineBuffer to short ints in DitherInputBuffer for the current colour //checking if it's blank as we go @@ -833,7 +834,7 @@ void DitherProcess(cups_lut_t **Lut, cups_dither_t **DitherState, cups_page_head //if(y == 0) DoLog("Dither stage colour %d line %d\n", Col, y); if(*BlankColour==0) { - cupsDitherLine(DitherState[Col], Lut[Col], DitherInputBuffer, 1, DitherOutputBuffer); + cfDitherLine(DitherState[Col], Lut[Col], DitherInputBuffer, 1, DitherOutputBuffer); // full scale input is 4095. output is the index in the lut. } if(Col == MonitorColour) //0=cyan 1=mag 2=yellow 3=black @@ -944,8 +945,8 @@ main(int argc, char *argv[]) /* I - Number of command-line arguments, Command- ppd_file_t *ppd; /* PPD file */ cups_raster_t *ras; /* Raster stream from cups */ cups_page_header2_t header; /* Page header from cups */ - cups_cmyk_t *cmykTrans300; /* cmyk transform for cups 300dpi*/ - cups_cmyk_t *cmykTrans600; /* cmyk transform for cups 600dpi*/ + cf_cmyk_t *cmykTrans300; /* cmyk transform for cups 300dpi*/ + cf_cmyk_t *cmykTrans600; /* cmyk transform for cups 600dpi*/ int RemainingPixels; int Stripe, y; int StripeEnd; //index of last byte in current stripe @@ -953,8 +954,8 @@ main(int argc, char *argv[]) /* I - Number of command-line arguments, Command- int Col,i,x; int BlankColour; //boolean to record if the line is blank to save time int argi; - cups_lut_t *Lut[4]; /* Dither lookup tables */ - cups_dither_t *DitherState[4]; /* Dither states */ + cf_lut_t *Lut[4]; /* Dither lookup tables */ + cf_dither_t *DitherState[4]; /* Dither states */ long RasForCompHeight; StartTime = time(NULL); @@ -1042,8 +1043,8 @@ main(int argc, char *argv[]) /* I - Number of command-line arguments, Command- if(ppd) { DoLog("Opened ppd OK. Reading from ppd\n",0,0); - cmykTrans300 = cupsCMYKLoad(ppd, "RGB", "", "300x1200dpi"); - cmykTrans600 = cupsCMYKLoad(ppd, "RGB", "", "600x1200dpi"); + cmykTrans300 = ppdCMYKLoad(ppd, "RGB", "", "300x1200dpi", NULL, NULL); + cmykTrans600 = ppdCMYKLoad(ppd, "RGB", "", "600x1200dpi", NULL, NULL); ppdClose(ppd); DoLog("InkChannels 300dpi=%d 600dpi=%d\n",cmykTrans300->num_channels,cmykTrans600->num_channels); } @@ -1233,8 +1234,8 @@ main(int argc, char *argv[]) /* I - Number of command-line arguments, Command- if (header.cupsColorSpace == CUPS_CSPACE_RGB) { if(y == 0) DoLog("Doing transform & dither (CMYK) stripe %d line %d\n", Stripe, y); - if(header.HWResolution[0] == 300) cupsCMYKDoRGB(cmykTrans300, CupsLineBuffer, TransformedBuffer, RemainingPixels); - else cupsCMYKDoRGB(cmykTrans600, CupsLineBuffer, TransformedBuffer, RemainingPixels); + if(header.HWResolution[0] == 300) cfCMYKDoRGB(cmykTrans300, CupsLineBuffer, TransformedBuffer, RemainingPixels); + else cfCMYKDoRGB(cmykTrans600, CupsLineBuffer, TransformedBuffer, RemainingPixels); // cupsDoRGB scales up to 4096 a short int from the unsigned char input 255 for(Col = 0; Col<4; ++Col) {