本文整理汇总了Java中org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorSpace方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtil.getDestinationColorSpace方法的具体用法?Java GraphicsUtil.getDestinationColorSpace怎么用?Java GraphicsUtil.getDestinationColorSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.batik.ext.awt.image.GraphicsUtil
的用法示例。
在下文中一共展示了GraphicsUtil.getDestinationColorSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
ColorSpace g2dCS = GraphicsUtil.getDestinationColorSpace(g2d);
if ((g2dCS == null) ||
(g2dCS != ColorSpace.getInstance(ColorSpace.CS_sRGB))){
// Only draw directly into sRGB destinations...
return false;
}
// System.out.println("drawImage GNR: " + g2dCS);
GraphicsNode gn = getGraphicsNode();
if (getUsePrimitivePaint()){
gn.primitivePaint(g2d);
}
else{
gn.paint(g2d);
}
// Paint did the work...
return true;
}