本文整理汇总了Java中org.apache.batik.ext.awt.image.GraphicsUtil.drawImage方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtil.drawImage方法的具体用法?Java GraphicsUtil.drawImage怎么用?Java GraphicsUtil.drawImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.batik.ext.awt.image.GraphicsUtil
的用法示例。
在下文中一共展示了GraphicsUtil.drawImage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintRable
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
* Should perform the equivilent action as
* createRendering followed by drawing the RenderedImage to
* Graphics2D, or return false.
*
* @param g2d The Graphics2D to draw to.
* @return true if the paint call succeeded, false if
* for some reason the paint failed (in which
* case a createRendering should be used).
*/
public boolean paintRable(Graphics2D g2d) {
// This optimization only apply if we are using
// SrcOver. Otherwise things break...
Composite c = g2d.getComposite();
if (!SVGComposite.OVER.equals(c))
return false;
// For the over mode we can just draw them in order...
if (getCompositeRule() != CompositeRule.OVER)
return false;
ColorSpace crCS = getOperationColorSpace();
ColorSpace g2dCS = GraphicsUtil.getDestinationColorSpace(g2d);
if ((g2dCS == null) || (g2dCS != crCS)) {
return false;
}
// System.out.println("drawImage : " + g2dCS +
// crCS);
Iterator i = getSources().iterator();
while (i.hasNext()) {
GraphicsUtil.drawImage(g2d, (Filter)i.next());
}
return true;
}
示例2: paintRable
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
* Should perform the equivilent action as
* createRendering followed by drawing the RenderedImage to
* Graphics2D, or return false.
*
* @param g2d The Graphics2D to draw to.
* @return true if the paint call succeeded, false if
* for some reason the paint failed (in which
* case a createRendering should be used).
*/
public boolean paintRable(Graphics2D g2d) {
// This optimization only apply if we are using
// SrcOver. Otherwise things break...
Composite c = g2d.getComposite();
if (!SVGComposite.OVER.equals(c))
return false;
if (getPadMode() != PadMode.ZERO_PAD)
return false;
Rectangle2D padBounds = getPadRect();
Shape clip = g2d.getClip();
g2d.clip(padBounds);
GraphicsUtil.drawImage(g2d, getSource());
g2d.setClip(clip);
return true;
}
示例3: paintRable
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
* Should perform the equivilent action as
* createRendering followed by drawing the RenderedImage to
* Graphics2D, or return false.
*
* @param g2d The Graphics2D to draw to.
* @return true if the paint call succeeded, false if
* for some reason the paint failed (in which
* case a createRendering should be used).
*/
public boolean paintRable(Graphics2D g2d) {
// This optimization only apply if we are using
// SrcOver. Otherwise things break...
Composite c = g2d.getComposite();
if (!SVGComposite.OVER.equals(c))
return false;
GraphicsUtil.drawImage(g2d, getSource());
return true;
}
示例4: paintRable
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
* Should perform the equivilent action as
* createRendering followed by drawing the RenderedImage.
*
* @param g2d The Graphics2D to draw to.
* @return true if the paint call succeeded, false if
* for some reason the paint failed (in which
* case a createRendering should be used).
*/
public boolean paintRable(Graphics2D g2d) {
AffineTransform at = g2d.getTransform();
g2d.transform(getAffine());
GraphicsUtil.drawImage(g2d, getSource());
g2d.setTransform(at);
return true;
}
示例5: genRect_OVER
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public void genRect_OVER(WritableRaster wr) {
// long startTime = System.currentTimeMillis();
// System.out.println("Comp GenR: " + wr);
Rectangle r = wr.getBounds();
ColorModel cm = getColorModel();
BufferedImage bi = new BufferedImage
(cm, wr.createWritableTranslatedChild(0,0),
cm.isAlphaPremultiplied(), null);
Graphics2D g2d = GraphicsUtil.createGraphics(bi);
g2d.translate(-r.x, -r.y);
Iterator i = srcs.iterator();
boolean first = true;
while (i.hasNext()) {
CachableRed cr = (CachableRed)i.next();
if (first) {
Rectangle crR = cr.getBounds();
if ((r.x < crR.x) ||
(r.y < crR.y) ||
(r.x+r.width > crR.x+crR.width) ||
(r.y+r.height > crR.y+crR.height))
// Portions outside my bounds, zero them...
emptyRect(wr);
// Fill in initial image...
cr.copyData(wr);
GraphicsUtil.coerceData(wr, cr.getColorModel(),
cm.isAlphaPremultiplied());
first = false;
} else {
GraphicsUtil.drawImage(g2d, cr);
}
}
// long endTime = System.currentTimeMillis();
// System.out.println("OVER: " + (endTime-startTime));
}
示例6: primitivePaint
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
* Paints this node without applying Filter, Mask, Composite and clip.
*
* @param g2d the Graphics2D to use
*/
public void primitivePaint(Graphics2D g2d) {
if (image == null) return;
GraphicsUtil.drawImage(g2d, image);
}
示例7: fillRasterFrom
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public WritableRaster fillRasterFrom(WritableRaster wr, RenderedImage src){
// System.out.println("Getting Raster : " + count + " " + wr.getMinX() + "/" + wr.getMinY() + "/" + wr.getWidth() + "/" + wr.getHeight());
// System.out.println("Tile : " + tile.getMinX() + "/" + tile.getMinY() + "/" + tile.getWidth() + "/" + tile.getHeight());
ColorModel cm = getColorModel();
BufferedImage bi
= new BufferedImage(cm,
wr.createWritableTranslatedChild(0, 0),
cm.isAlphaPremultiplied(), null);
Graphics2D g = GraphicsUtil.createGraphics(bi, hints);
int minX = wr.getMinX();
int minY = wr.getMinY();
int maxX = wr.getWidth();
int maxY = wr.getHeight();
g.setComposite(AlphaComposite.Clear);
g.setColor(new Color(0, 0, 0, 0));
g.fillRect(0, 0, maxX, maxY);
g.setComposite(AlphaComposite.SrcOver);
g.translate(-minX, -minY);
// Process initial translate so that tile is
// painted to the left of the raster top-left
// corner on the first drawRenderedImage
int x1 = src.getMinX()+src.getWidth()-1;
int y1 = src.getMinY()+src.getHeight()-1;
int tileTx = (int)Math.ceil(((minX-x1)/xStep))*xStep;
int tileTy = (int)Math.ceil(((minY-y1)/yStep))*yStep;
g.translate(tileTx, tileTy);
int curX = tileTx - wr.getMinX() + src.getMinX();
int curY = tileTy - wr.getMinY() + src.getMinY();
// System.out.println("Wr: " + wr.getBounds());
// System.out.println("Src : [" + src.getMinX() + ", " +
// src.getMinY() + ", " +
// src.getWidth() + ", " +
// src.getHeight() + "]");
// System.out.println("tileTx/tileTy : " + tileTx + " / " + tileTy);
minX = curX;
while(curY < maxY) {
if (HaltingThread.hasBeenHalted())
return wr;
while (curX < maxX) {
// System.out.println("curX/curY : " + curX + " / " + curY);
// System.out.println("transform : " +
// g.getTransform().getTranslateX() +
// " / " +
// g.getTransform().getTranslateY());
GraphicsUtil.drawImage(g, src);
curX += xStep;
g.translate(xStep, 0);
}
curY += yStep;
g.translate(minX-curX, yStep);
curX = minX;
}
/*g.setTransform(new AffineTransform());
g.setPaint(colors[count++]);
count %= colors.length;
g.fillRect(0, 0, maxX, maxY);*/
// Don't coerceData since it will be in the proper alpha state
// due to the drawing.
// GraphicsUtil.coerceData(wr, src.getColorModel(), alphaPremult);
return wr;
}