本文整理汇总了Java中org.apache.batik.ext.awt.image.GraphicsUtil.copyData方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtil.copyData方法的具体用法?Java GraphicsUtil.copyData怎么用?Java GraphicsUtil.copyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.batik.ext.awt.image.GraphicsUtil
的用法示例。
在下文中一共展示了GraphicsUtil.copyData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyData
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public WritableRaster copyData(WritableRaster wr) {
ColorModel cm = getColorModel();
CachableRed cr = getSource();
ColorModel srcCM = cr.getColorModel();
SampleModel srcSM = cr.getSampleModel();
srcSM = srcSM.createCompatibleSampleModel(wr.getWidth(),
wr.getHeight());
WritableRaster srcWR;
srcWR = Raster.createWritableRaster(srcSM, new Point(wr.getMinX(),
wr.getMinY()));
getSource().copyData(srcWR);
BufferedImage srcBI = new BufferedImage
(srcCM, srcWR.createWritableTranslatedChild(0,0),
srcCM.isAlphaPremultiplied(), null);
BufferedImage dstBI = new BufferedImage
(cm, wr.createWritableTranslatedChild(0,0),
cm.isAlphaPremultiplied(), null);
GraphicsUtil.copyData(srcBI, dstBI);
return wr;
}
示例2: copyData
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public WritableRaster copyData(WritableRaster wr) {
WritableRaster wr2 = wr.createWritableTranslatedChild
(wr.getMinX()-getMinX(),
wr.getMinY()-getMinY());
GraphicsUtil.copyData(bi.getRaster(), wr2);
/* This was the original code. This is _bad_ since it causes a
* multiply and divide of the alpha channel to do the draw
* operation. I believe that at some point I switched to
* drawImage in order to avoid some issues with
* BufferedImage's copyData implementation but I can't
* reproduce them now. Anyway I'm now using GraphicsUtil which
* should generally be as fast if not faster...
*/
/*
BufferedImage dest;
dest = new BufferedImage(bi.getColorModel(),
wr.createWritableTranslatedChild(0,0),
bi.getColorModel().isAlphaPremultiplied(),
null);
java.awt.Graphics2D g2d = dest.createGraphics();
g2d.drawImage(bi, null, getMinX()-wr.getMinX(),
getMinY()-wr.getMinY());
g2d.dispose();
*/
return wr;
}
示例3: copyData
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public WritableRaster copyData(WritableRaster wr) {
GraphicsUtil.copyData(theTile, wr);
return wr;
}
示例4: filter
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
* This implementation of filter does the morphology operation
* on a premultiplied alpha image. This tends to muddy the
* colors. so something that is supposed to be a mostly
* transparent bright red may well become a muddy opaque red.
* Where as I think it should become a bright opaque red. Which
* is the result you would get if you were using unpremult data.
*/
public BufferedImage filter(BufferedImage src, BufferedImage dest){
if (src == null)
throw new NullPointerException("Source image should not be null");
BufferedImage origSrc = src;
BufferedImage finalDest = dest;
if (!isCompatible(src.getColorModel(), src.getSampleModel())) {
src = new BufferedImage(src.getWidth(), src.getHeight(),
BufferedImage.TYPE_INT_ARGB_PRE);
GraphicsUtil.copyData(origSrc, src);
}
else if (!src.isAlphaPremultiplied()) {
// Get a Premultipled CM.
ColorModel srcCM, srcCMPre;
srcCM = src.getColorModel();
srcCMPre = GraphicsUtil.coerceColorModel(srcCM, true);
src = new BufferedImage(srcCMPre, src.getRaster(),
true, null);
GraphicsUtil.copyData(origSrc, src);
}
if (dest == null) {
dest = createCompatibleDestImage(src, null);
finalDest = dest;
} else if (!isCompatible(dest.getColorModel(),
dest.getSampleModel())) {
dest = createCompatibleDestImage(src, null);
} else if (!dest.isAlphaPremultiplied()) {
// Get a Premultipled CM.
ColorModel dstCM, dstCMPre;
dstCM = dest.getColorModel();
dstCMPre = GraphicsUtil.coerceColorModel(dstCM, true);
dest = new BufferedImage(dstCMPre, finalDest.getRaster(),
true, null);
}
filter(src.getRaster(), dest.getRaster());
// Check to see if we need to 'fix' our source (divide out alpha).
if ((src.getRaster() == origSrc.getRaster()) &&
(src.isAlphaPremultiplied() != origSrc.isAlphaPremultiplied())) {
// Copy our source back the way it was...
GraphicsUtil.copyData(src, origSrc);
}
// Check to see if we need to store our result...
if ((dest.getRaster() != finalDest.getRaster()) ||
(dest.isAlphaPremultiplied() != finalDest.isAlphaPremultiplied())){
// Coerce our source back the way it was requested...
GraphicsUtil.copyData(dest, finalDest);
}
return finalDest;
}