]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/imagetoraster.c
Merge changes from CUPS 1.4svn-r7696.
[thirdparty/cups.git] / filter / imagetoraster.c
index 32bc9a7c79edd19717d14d3ba62e0bc91198fe3c..ba21bdb1c652f7ea7129eb3cd06c274cc94bbbd0 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: imagetoraster.c 5522 2006-05-15 05:02:15Z mike $"
+ * "$Id: imagetoraster.c 7306 2008-02-15 00:52:38Z mike $"
  *
  *   Image file to raster filter for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 1993-2006 by Easy Software Products.
+ *   Copyright 2007 by Apple Inc.
+ *   Copyright 1993-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -46,9 +37,9 @@
 
 #include "common.h"
 #include "image-private.h"
-#include "raster.h"
 #include <unistd.h>
 #include <math.h>
+#include <cups/i18n.h>
 
 
 /*
@@ -213,13 +204,11 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
   if (argc < 6 || argc > 7)
   {
-    fputs("ERROR: imagetoraster job-id user title copies options [file]\n", stderr);
+    fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
+            argv[0]);
     return (1);
   }
 
-  fprintf(stderr, "INFO: %s %s %s %s %s %s %s\n", argv[0], argv[1], argv[2],
-          argv[3], argv[4], argv[5], argv[6] ? argv[6] : "(null)");
-
  /*
   * See if we need to use the imagetops and pstoraster filters instead...
   */
@@ -446,8 +435,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
   if ((val = cupsGetOption("hue", num_options, options)) != NULL)
     hue = atoi(val);
 
-  if ((val = cupsGetOption("mirror", num_options, options)) != NULL &&
-      strcasecmp(val, "True") == 0)
+  if ((choice = ppdFindMarkedChoice(ppd, "MirrorPrint")) != NULL)
+  {
+    val = choice->choice;
+    choice->marked = 0;
+  }
+  else
+    val = cupsGetOption("mirror", num_options, options);
+
+  if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+              !strcasecmp(val, "yes")))
     Flip = 1;
 
  /*
@@ -456,7 +453,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (cupsRasterInterpretPPD(&header, ppd, num_options, options, raster_cb))
   {
-    fputs("ERROR: Bad page setup!\n", stderr);
+    fputs(_("ERROR: Bad page setup!\n"), stderr);
+    fprintf(stderr, "DEBUG: %s\n", cupsRasterErrorString());
     return (1);
   }
 
@@ -618,7 +616,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   * Open the input image to print...
   */
 
-  fputs("INFO: Loading image file...\n", stderr);
+  fputs(_("INFO: Loading image file...\n"), stderr);
 
   if (header.cupsColorSpace == CUPS_CSPACE_CIEXYZ ||
       header.cupsColorSpace == CUPS_CSPACE_CIELab ||
@@ -632,7 +630,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (img == NULL)
   {
-    fputs("ERROR: Unable to open image file for printing!\n", stderr);
+    fputs(_("ERROR: Unable to open image file for printing!\n"), stderr);
     ppdClose(ppd);
     return (1);
   }
@@ -1137,7 +1135,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
     for (xpage = 0; xpage < xpages; xpage ++)
       for (ypage = 0; ypage < ypages; ypage ++, page ++)
       {
-        fprintf(stderr, "INFO: Formatting page %d...\n", page);
+        fprintf(stderr, _("INFO: Formatting page %d...\n"), page);
 
        if (Orientation & 1)
        {
@@ -1194,7 +1192,8 @@ main(int  argc,                           /* I - Number of command-line arguments */
              if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
                      header.cupsBytesPerLine)
              {
-               fputs("ERROR: Unable to write raster data to driver!\n", stderr);
+               fputs(_("ERROR: Unable to write raster data to driver!\n"),
+                     stderr);
                cupsImageClose(img);
                exit(1);
              }
@@ -1289,7 +1288,8 @@ main(int  argc,                           /* I - Number of command-line arguments */
            if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
                                      header.cupsBytesPerLine)
            {
-              fputs("ERROR: Unable to write raster data to driver!\n", stderr);
+              fputs(_("ERROR: Unable to write raster data to driver!\n"),
+                   stderr);
              cupsImageClose(img);
              exit(1);
            }
@@ -1328,7 +1328,8 @@ main(int  argc,                           /* I - Number of command-line arguments */
              if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
                      header.cupsBytesPerLine)
              {
-               fputs("ERROR: Unable to write raster data to driver!\n", stderr);
+               fputs(_("ERROR: Unable to write raster data to driver!\n"),
+                     stderr);
                cupsImageClose(img);
                exit(1);
              }
@@ -4310,5 +4311,5 @@ raster_cb(
 
 
 /*
- * End of "$Id: imagetoraster.c 5522 2006-05-15 05:02:15Z mike $".
+ * End of "$Id: imagetoraster.c 7306 2008-02-15 00:52:38Z mike $".
  */