当前位置: 首页>>代码示例>>Java>>正文


Java PrinterGraphics类代码示例

本文整理汇总了Java中java.awt.print.PrinterGraphics的典型用法代码示例。如果您正苦于以下问题:Java PrinterGraphics类的具体用法?Java PrinterGraphics怎么用?Java PrinterGraphics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PrinterGraphics类属于java.awt.print包,在下文中一共展示了PrinterGraphics类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
/**
 * {@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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:AbstractRegionPainter.java

示例2: paint

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
/**
 * {@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);
    }
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:20,代码来源:AbstractRegionPainter.java

示例3: paint

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
/**
 * @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);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:24,代码来源:AbstractRegionPainter.java

示例4: setHostGraphics

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
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);
}
 
开发者ID:phuseman,项目名称:r2cat,代码行数:18,代码来源:PixelGraphics2D.java

示例5: paint

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
/**
 * @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);
    }
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:24,代码来源:AbstractRegionPainter.java

示例6: isPrinting

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:SwingUtilities2.java

示例7: isPrinting

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
private static boolean isPrinting(Graphics g) {
    return g instanceof PrintGraphics || g instanceof PrinterGraphics;
}
 
开发者ID:LGoodDatePicker,项目名称:LGoodDatePicker,代码行数:4,代码来源:RenderingUtils.java

示例8: isPrinting

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
private static boolean isPrinting(Graphics g)
/* 113:    */   {
/* 114:190 */     return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics));
/* 115:    */   }
 
开发者ID:xiwc,项目名称:confluence.keygen,代码行数:5,代码来源:RenderingUtils.java

示例9: paintComponent

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
/**
 * 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.");
}
 
开发者ID:phuseman,项目名称:r2cat,代码行数:55,代码来源:BufferedPanel.java

示例10: isPrinting

import java.awt.print.PrinterGraphics; //导入依赖的package包/类
private static boolean isPrinting(Graphics g)
{
  return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics));
}
 
开发者ID:javachen,项目名称:IBMDataMovementTool,代码行数:5,代码来源:RenderingUtils.java


注:本文中的java.awt.print.PrinterGraphics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。