Java 类java.awt.print.PrinterGraphics 实例源码

项目:OpenJSharp    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:jdk8u-jdk    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:openjdk-jdk10    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:openjdk9    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:Java8CN    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:jdk8u_jdk    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:seaglass    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    // don't render if the width/height are too small
    if (w <= 0 || h <= 0)
        return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);

    ctx = getPaintContext();
    CacheMode cacheMode = ctx == null ? CacheMode.NO_CACHING : ctx.getCacheMode();

    if (cacheMode == CacheMode.NO_CACHING || !ImageCache.getInstance().isImageCachable(w, h) || g instanceof PrinterGraphics) {
        paintDirectly(g, c, w, h, extendedCacheKeys);
    } else {
        paintWithCaching(g, c, w, h, extendedCacheKeys);
    }
}
项目:infobip-open-jdk-8    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:jdk8u-dev-jdk    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:jdk7-jdk    文件:AbstractRegionPainter.java   
/**
 * @inheritDoc
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:openjdk-source-code-learn    文件:AbstractRegionPainter.java   
/**
 * @inheritDoc
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:OLD-OpenJDK8    文件:AbstractRegionPainter.java   
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:r2cat    文件:PixelGraphics2D.java   
protected void setHostGraphics(Graphics graphics) {
    hostGraphics = (Graphics2D) graphics;
    resolution = (graphics instanceof PrinterGraphics) ? 0 : 1;
    tagHandler = new GenericTagHandler(hostGraphics);

    super.setBackground(hostGraphics.getBackground());
    super.setColor(hostGraphics.getColor());
    super.setPaint(hostGraphics.getPaint());
    super.setFont(hostGraphics.getFont());

    Stroke s = hostGraphics.getStroke();
    if (s instanceof BasicStroke) {
        lineWidth = ((BasicStroke) s).getLineWidth();
    }
    webColor = WebColor.create(getColor());
    setRenderingHint(KEY_SYMBOL_BLIT, VALUE_SYMBOL_BLIT_ON);
}
项目:openjdk-jdk7u-jdk    文件:AbstractRegionPainter.java   
/**
 * @inheritDoc
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:openjdk-icedtea7    文件:AbstractRegionPainter.java   
/**
 * @inheritDoc
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:JRLib    文件:AbstractRegionPainter.java   
/**
 * @inheritDoc
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
项目:OpenJSharp    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:jdk8u-jdk    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:openjdk-jdk10    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:openjdk9    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:jdk8u_jdk    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:lookaside_java-1.8.0-openjdk    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:LGoodDatePicker    文件:RenderingUtils.java   
private static boolean isPrinting(Graphics g) {
    return g instanceof PrintGraphics || g instanceof PrinterGraphics;
}
项目:JCheckboxTree    文件:RenderingUtils.java   
private static boolean isPrinting(Graphics g) {
    return g instanceof PrintGraphics || g instanceof PrinterGraphics;
}
项目:confluence.keygen    文件:RenderingUtils.java   
private static boolean isPrinting(Graphics g)
/* 113:    */   {
/* 114:190 */     return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics));
/* 115:    */   }
项目:infobip-open-jdk-8    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:jdk8u-dev-jdk    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:jdk7-jdk    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:openjdk-source-code-learn    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:OLD-OpenJDK8    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:r2cat    文件:BufferedPanel.java   
/**
 * Paint this panel by calling paintComponent(VectorGraphics) if necessary
 * and flushing the buffered image to the screen. This method also handles
 * printing and exporting separately.
 * 
 * @param g Graphics object
 */
public void paintComponent(Graphics g) {
    super.paintComponent(g);

    // do not paint if params are null
    if ((g == null) || (offScreenImage == null))
        return;

    // decide where we are painting
    if (g instanceof PrinterGraphics)
        printing = true;
    if (g instanceof VectorGraphics)
        exporting = true;

    if (!isDisplaying()) {
        paintComponent(VectorGraphics.create(g));
        return;
    }

    if (shouldRepaint()) {
        paintComponent(offScreenGraphics);
    }

    // copy buffer to screen
    //long t0 = System.currentTimeMillis();

    /*
     * FREEHEP-503 Disabled, since in Linux this made the blitting very
     * slow.
     * 
     * Despite what the API documentation says, getClipBounds()
     * returns the current dirty region. This can then be used to speedup
     * the drawing of the BufferedPanel.
     */ 

    // clip = g.getClipBounds(clip);
    // Make sure the clip is not larger than the bounds. 
    // clip = clip.intersection(getBounds());
    // BufferedImage bufferedImage = (BufferedImage)offScreenImage;
    // BufferedImage subimage = bufferedImage.getSubimage(clip.x,clip.y,
    // clip.width,clip.height); boolean done =
    // g.drawImage(subimage,clip.x,clip.y,this);


    /* boolean done = */ g.drawImage(offScreenImage, 0, 0, this);
    // System.err.println("CopyImage "+done+" took:
    // "+(System.currentTimeMillis()-t0)+" ms.");
}
项目:openjdk-jdk7u-jdk    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
项目:IBMDataMovementTool    文件:RenderingUtils.java   
private static boolean isPrinting(Graphics g)
{
  return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics));
}
项目:IBMDataMovementTool    文件:RenderingUtils.java   
private static boolean isPrinting(Graphics g) {
    return g instanceof PrintGraphics || g instanceof PrinterGraphics;
}
项目:openjdk-icedtea7    文件:SwingUtilities2.java   
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}