sun.print.PeekGraphics Java Examples

The following examples show how to use sun.print.PeekGraphics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #2
Source File: WPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #3
Source File: WPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #4
Source File: WPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #5
Source File: WPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #6
Source File: WPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * {@code PeekGraphics} instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a {@code PathGraphics} to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * {@code null}. Returning {@code null}
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #7
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #8
Source File: WPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #9
Source File: WPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #10
Source File: WPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #11
Source File: WPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #12
Source File: WPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}
 
Example #13
Source File: WPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Examine the metrics captured by the
 * <code>PeekGraphics</code> instance and
 * if capable of directly converting this
 * print job to the printer's control language
 * or the native OS's graphics primitives, then
 * return a <code>PathGraphics</code> to perform
 * that conversion. If there is not an object
 * capable of the conversion then return
 * <code>null</code>. Returning <code>null</code>
 * causes the print job to be rasterized.
 */

@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                        PrinterJob printerJob,
                                        Printable painter,
                                        PageFormat pageFormat,
                                        int pageIndex) {

    WPathGraphics pathGraphics;
    PeekMetrics metrics = peekGraphics.getMetrics();

    /* If the application has drawn anything that
     * out PathGraphics class can not handle then
     * return a null PathGraphics. If the property
     * to force the raster pipeline has been set then
     * we also want to avoid the path (pdl) pipeline
     * and return null.
     */
   if (forcePDL == false && (forceRaster == true
                              || metrics.hasNonSolidColors()
                              || metrics.hasCompositing()
                              )) {
        pathGraphics = null;
    } else {
        BufferedImage bufferedImage = new BufferedImage(8, 8,
                                        BufferedImage.TYPE_INT_RGB);
        Graphics2D bufferedGraphics = bufferedImage.createGraphics();

        boolean canRedraw = peekGraphics.getAWTDrawingOnly() == false;
        pathGraphics =  new WPathGraphics(bufferedGraphics, printerJob,
                                          painter, pageFormat, pageIndex,
                                          canRedraw);
    }

    return pathGraphics;
}