jdk/src/share/classes/sun/print/PSPrinterJob.java
changeset 25774 21b78da4b2df
parent 25144 e2bf17cee34b
equal deleted inserted replaced
25773:07cae3ef5f57 25774:21b78da4b2df
   166     private static final String SHOWPAGE =      "showpage";
   166     private static final String SHOWPAGE =      "showpage";
   167     private static final String IMAGE_SAVE =    "/imSave save def";
   167     private static final String IMAGE_SAVE =    "/imSave save def";
   168     private static final String IMAGE_STR =     " string /imStr exch def";
   168     private static final String IMAGE_STR =     " string /imStr exch def";
   169     private static final String IMAGE_RESTORE = "imSave restore";
   169     private static final String IMAGE_RESTORE = "imSave restore";
   170 
   170 
   171     private static final String COORD_PREP =    " 0 exch translate "
       
   172                                               + "1 -1 scale"
       
   173                                               + "[72 " + PS_XRES + " div "
       
   174                                               + "0 0 "
       
   175                                               + "72 " + PS_YRES + " div "
       
   176                                               + "0 0]concat";
       
   177 
       
   178     private static final String SetFontName = "F";
   171     private static final String SetFontName = "F";
   179 
   172 
   180     private static final String DrawStringName = "S";
   173     private static final String DrawStringName = "S";
   181 
   174 
   182     /**
   175     /**
   272    private Color mLastColor;
   265    private Color mLastColor;
   273 
   266 
   274    private Shape mLastClip;
   267    private Shape mLastClip;
   275 
   268 
   276    private AffineTransform mLastTransform;
   269    private AffineTransform mLastTransform;
       
   270 
       
   271    private double xres = PS_XRES;
       
   272    private double yres = PS_XRES;
   277 
   273 
   278    /* non-null if printing EPS for Java Plugin */
   274    /* non-null if printing EPS for Java Plugin */
   279    private EPSPrinter epsPrinter = null;
   275    private EPSPrinter epsPrinter = null;
   280 
   276 
   281    /**
   277    /**
   794                 throw spooler.pex;
   790                 throw spooler.pex;
   795             }
   791             }
   796         }
   792         }
   797     }
   793     }
   798 
   794 
       
   795     private String getCoordPrep() {
       
   796         return " 0 exch translate "
       
   797              + "1 -1 scale"
       
   798              + "[72 " + getXRes() + " div "
       
   799              + "0 0 "
       
   800              + "72 " + getYRes() + " div "
       
   801              + "0 0]concat";
       
   802     }
       
   803 
   799     /**
   804     /**
   800      * The RasterPrintJob super class calls this method
   805      * The RasterPrintJob super class calls this method
   801      * at the start of each page.
   806      * at the start of each page.
   802      */
   807      */
   803     protected void startPage(PageFormat pageFormat, Printable painter,
   808     protected void startPage(PageFormat pageFormat, Printable painter,
   850                 mPSStream.print(" /DeferredMediaSelection true");
   855                 mPSStream.print(" /DeferredMediaSelection true");
   851             }
   856             }
   852             mPSStream.println(" >> setpagedevice");
   857             mPSStream.println(" >> setpagedevice");
   853         }
   858         }
   854         mPSStream.println(PAGE_SAVE);
   859         mPSStream.println(PAGE_SAVE);
   855         mPSStream.println(paperHeight + COORD_PREP);
   860         mPSStream.println(paperHeight + getCoordPrep());
   856     }
   861     }
   857 
   862 
   858     /**
   863     /**
   859      * The RastePrintJob super class calls this method
   864      * The RastePrintJob super class calls this method
   860      * at the end of each page.
   865      * at the end of each page.
  1491     /**
  1496     /**
  1492      * Return the x resolution of the coordinates
  1497      * Return the x resolution of the coordinates
  1493      * to be rendered.
  1498      * to be rendered.
  1494      */
  1499      */
  1495     protected double getXRes() {
  1500     protected double getXRes() {
  1496         return PS_XRES;
  1501         return xres;
  1497     }
  1502     }
  1498     /**
  1503     /**
  1499      * Return the y resolution of the coordinates
  1504      * Return the y resolution of the coordinates
  1500      * to be rendered.
  1505      * to be rendered.
  1501      */
  1506      */
  1502     protected double getYRes() {
  1507     protected double getYRes() {
  1503         return PS_YRES;
  1508         return yres;
       
  1509     }
       
  1510 
       
  1511     /**
       
  1512      * Set the resolution at which to print.
       
  1513      */
       
  1514     protected void setXYRes(double x, double y) {
       
  1515         xres = x;
       
  1516         yres = y;
  1504     }
  1517     }
  1505 
  1518 
  1506     /**
  1519     /**
  1507      * For PostScript the origin is in the upper-left of the
  1520      * For PostScript the origin is in the upper-left of the
  1508      * paper not at the imageable area corner.
  1521      * paper not at the imageable area corner.