本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例6: isPrinting
import java.awt.print.PrinterGraphics; //导入依赖的package包/类
static boolean isPrinting(Graphics g) {
return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
示例7: isPrinting
import java.awt.print.PrinterGraphics; //导入依赖的package包/类
private static boolean isPrinting(Graphics g) {
return g instanceof PrintGraphics || g instanceof PrinterGraphics;
}
示例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: */ }
示例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.");
}
示例10: isPrinting
import java.awt.print.PrinterGraphics; //导入依赖的package包/类
private static boolean isPrinting(Graphics g)
{
return ((g instanceof PrintGraphics)) || ((g instanceof PrinterGraphics));
}