/** * {@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); } }
/** * {@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); } }
/** * @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); } }
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); }
static boolean isPrinting(Graphics g) { return (g instanceof PrinterGraphics || g instanceof PrintGraphics); }
private static boolean isPrinting(Graphics g) { return g instanceof PrintGraphics || g instanceof PrinterGraphics; }
private static boolean isPrinting(Graphics g) /* 113: */ { /* 114:190 */ return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics)); /* 115: */ }
/** * 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."); }
private static boolean isPrinting(Graphics g) { return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics)); }