本文整理汇总了Java中org.apache.batik.ext.awt.image.GraphicsUtil类的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtil类的具体用法?Java GraphicsUtil怎么用?Java GraphicsUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphicsUtil类属于org.apache.batik.ext.awt.image包,在下文中一共展示了GraphicsUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: renderGNR
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
protected CachableRed renderGNR() {
AffineTransform at, rcAT;
at = usr2dev;
rcAT = new AffineTransform(at.getScaleX(), at.getShearY(),
at.getShearX(), at.getScaleY(),
0, 0);
RenderContext rc = new RenderContext(rcAT, null, renderingHints);
RenderedImage ri = rootFilter.createRendering(rc);
if (ri == null)
return null;
CachableRed ret;
ret = GraphicsUtil.wrap(ri);
ret = setupCache(ret);
int dx = Math.round((float)at.getTranslateX());
int dy = Math.round((float)at.getTranslateY());
ret = new TranslateRed(ret, ret.getMinX()+dx, ret.getMinY()+dy);
ret = GraphicsUtil.convertTosRGB(ret);
return ret;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:StaticRenderer.java
示例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;
// 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;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:36,代码来源:CompositeRable8Bit.java
示例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;
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;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:PadRable8Bit.java
示例4: 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;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:22,代码来源:FilterChainRable8Bit.java
示例5: copyData
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public WritableRaster copyData(WritableRaster wr) {
int tx0 = getXTile(wr.getMinX());
int ty0 = getYTile(wr.getMinY());
int tx1 = getXTile(wr.getMinX()+wr.getWidth() -1);
int ty1 = getYTile(wr.getMinY()+wr.getHeight()-1);
final boolean is_INT_PACK =
GraphicsUtil.is_INT_PACK_Data(getSampleModel(), false);
for (int y=ty0; y<=ty1; y++)
for (int x=tx0; x<=tx1; x++) {
Raster r = getTile(x, y);
if (is_INT_PACK)
GraphicsUtil.copyData_INT_PACK(r, wr);
else
GraphicsUtil.copyData_FALLBACK(r, wr);
}
return wr;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:FloodRed.java
示例6: ComponentTransferRed
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
/**
* The constructor will instantiate a LookupOp instance using
* a LookupOp, which is built using the four LUT
* data obtained by the TransferFunction objects
* funcs[0] : Alpha component transfer function
* funcs[1] : Red component transfer function
* funcs[2] : Green component transfer function
* funcs[3] : Blue component transfer function
*/
public ComponentTransferRed(CachableRed src,
TransferFunction [] funcs,
RenderingHints hints) {
super(src, src.getBounds(),
GraphicsUtil.coerceColorModel(src.getColorModel(), false),
src.getSampleModel(),
null);
byte [][] tableData = {funcs[1].getLookupTable(),
funcs[2].getLookupTable(),
funcs[3].getLookupTable(),
funcs[0].getLookupTable()};
// Note that we create an anonymous subclass here.
// For what ever reason this makes the Op work correctly.
// If you remove this, it seems to get the color channels messed
// up. The downside is that I suspect that this means we are
// falling into a more general, and hence slower case, but
// at least it works....
operation = new LookupOp(new ByteLookupTable(0, tableData), hints)
{ };
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:32,代码来源:ComponentTransferRed.java
示例7: ColorMatrixRed
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public ColorMatrixRed(CachableRed src, float[][] matrix){
setMatrix(matrix);
ColorModel srcCM = src.getColorModel();
ColorSpace srcCS = null;
if (srcCM != null)
srcCS = srcCM.getColorSpace();
ColorModel cm;
if (srcCS == null)
cm = GraphicsUtil.Linear_sRGB_Unpre;
else {
if (srcCS == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))
cm = GraphicsUtil.Linear_sRGB_Unpre;
else
cm = GraphicsUtil.sRGB_Unpre;
}
SampleModel sm =
cm.createCompatibleSampleModel(src.getWidth(),
src.getHeight());
init(src, src.getBounds(), cm, sm,
src.getTileGridXOffset(), src.getTileGridYOffset(), null);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:ColorMatrixRed.java
示例8: copyToRaster
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
/**
* Copies data from this images tile grid into wr. wr may
* extend outside the bounds of this image in which case the
* data in wr outside the bounds will not be touched.
* @param wr Raster to fill with image data.
*/
public void copyToRaster(WritableRaster wr) {
int tx0 = getXTile(wr.getMinX());
int ty0 = getYTile(wr.getMinY());
int tx1 = getXTile(wr.getMinX()+wr.getWidth() -1);
int ty1 = getYTile(wr.getMinY()+wr.getHeight()-1);
if (tx0 < minTileX) tx0 = minTileX;
if (ty0 < minTileY) ty0 = minTileY;
if (tx1 >= minTileX+numXTiles) tx1 = minTileX+numXTiles-1;
if (ty1 >= minTileY+numYTiles) ty1 = minTileY+numYTiles-1;
final boolean is_INT_PACK =
GraphicsUtil.is_INT_PACK_Data(getSampleModel(), false);
for (int y=ty0; y<=ty1; y++)
for (int x=tx0; x<=tx1; x++) {
Raster r = getTile(x, y);
if (is_INT_PACK)
GraphicsUtil.copyData_INT_PACK(r, wr);
else
GraphicsUtil.copyData_FALLBACK(r, wr);
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:31,代码来源:AbstractRed.java
示例9: fixColorModel
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
protected static ColorModel fixColorModel(CachableRed src) {
ColorModel cm = src.getColorModel();
if (cm.hasAlpha()) {
if (!cm.isAlphaPremultiplied())
cm = GraphicsUtil.coerceColorModel(cm, true);
return cm;
}
int b = src.getSampleModel().getNumBands()+1;
if (b > 4)
throw new IllegalArgumentException
("CompositeRed can only handle up to three band images");
int [] masks = new int[4];
for (int i=0; i < b-1; i++)
masks[i] = 0xFF0000 >> (8*i);
masks[3] = 0xFF << (8*(b-1));
ColorSpace cs = cm.getColorSpace();
return new DirectColorModel(cs, 8*b, masks[0], masks[1],
masks[2], masks[3],
true, DataBuffer.TYPE_INT);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:CompositeRed.java
示例10: copyData
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public WritableRaster copyData(WritableRaster wr) {
int xOff = ((int)Math.floor(wr.getMinX()/xStep))*xStep;
int yOff = ((int)Math.floor(wr.getMinY()/yStep))*yStep;
int x0 = wr.getMinX()-xOff;
int y0 = wr.getMinY()-yOff;
int tx0 = getXTile(x0);
int ty0 = getYTile(y0);
int tx1 = getXTile(x0+wr.getWidth() -1);
int ty1 = getYTile(y0+wr.getHeight()-1);
for (int y=ty0; y<=ty1; y++)
for (int x=tx0; x<=tx1; x++) {
Raster r = getTile(x, y);
r = r.createChild(r.getMinX(), r.getMinY(),
r.getWidth(), r.getHeight(),
r.getMinX()+xOff, r.getMinY()+yOff, null);
if (is_INT_PACK)
GraphicsUtil.copyData_INT_PACK(r, wr);
else
GraphicsUtil.copyData_FALLBACK(r, wr);
}
return wr;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:TileRed.java
示例11: 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;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:FormatRed.java
示例12: createGraphics
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
@Override
public Graphics2D createGraphics(BufferedImage bi)
{
Graphics2D graphics = GraphicsUtil.createGraphics(bi);
if (isAntiAlias())
{
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//FIXME use JPG instead of PNG for smaller size?
}
return graphics;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:SimpleRenderToImageAwareDataRenderer.java
示例13: createGraphics
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
@Override
public Graphics2D createGraphics(BufferedImage bi)
{
Graphics2D graphics = GraphicsUtil.createGraphics(bi);
if (antiAlias)
{
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//FIXME use JPG instead of PNG for smaller size?
}
return graphics;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:BatikRenderer.java
示例14: getRaster
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public Raster getRaster(int x, int y, int width, int height){
// System.out.println("GetRaster: [" + x + ", " + y + ", "
// + width + ", " + height + "]");
if ((raster == null) ||
(raster.getWidth() < width) ||
(raster.getHeight() < height)) {
raster = rasterCM.createCompatibleWritableRaster(width, height);
}
WritableRaster wr
= raster.createWritableChild(0, 0, width, height, x, y, null);
tiled.copyData(wr);
GraphicsUtil.coerceData(wr, tiled.getColorModel(),
rasterCM.isAlphaPremultiplied());
// On Mac OS X it always wants the raster at 0,0 if the
// requested width and height matches raster we can just
// return it. Otherwise we create a translated child that
// lives at 0,0.
if ((raster.getWidth() == width) &&
(raster.getHeight() == height))
return raster;
return wr.createTranslatedChild(0,0);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:28,代码来源:PatternPaintContext.java
示例15: 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;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:37,代码来源:GraphicsNodeRable8Bit.java
示例16: genRect
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public void genRect(WritableRaster wr) {
// System.out.println(" Rect: " + wr.getBounds());
BufferedImage offScreen
= new BufferedImage(cm,
wr.createWritableTranslatedChild(0,0),
cm.isAlphaPremultiplied(),
null);
Graphics2D g = GraphicsUtil.createGraphics(offScreen, hints);
g.setComposite(AlphaComposite.Clear);
g.fillRect(0, 0, wr.getWidth(), wr.getHeight());
g.setComposite(AlphaComposite.SrcOver);
g.translate(-wr.getMinX(), -wr.getMinY());
// Set transform
g.transform(node2dev);
// Invoke primitive paint.
if (usePrimitivePaint) {
node.primitivePaint(g);
}
else {
node.paint (g);
}
g.dispose();
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:GraphicsNodeRed8Bit.java
示例17: getBrokenLinkImage
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public Filter getBrokenLinkImage(Object base,
String code, Object [] params) {
synchronized (DefaultBrokenLinkProvider.class) {
if (brokenLinkImg != null)
return brokenLinkImg;
BufferedImage bi;
bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
// Put the broken link property in the image so people know
// This isn't the "real" image.
Hashtable ht = new Hashtable();
ht.put(BROKEN_LINK_PROPERTY,
formatMessage(base, code, params));
bi = new BufferedImage(bi.getColorModel(), bi.getRaster(),
bi.isAlphaPremultiplied(),
ht);
Graphics2D g2d = bi.createGraphics();
g2d.setColor( BROKEN_LINK_COLOR );
g2d.fillRect(0, 0, 100, 100);
g2d.setColor(Color.black);
g2d.drawRect(2, 2, 96, 96);
g2d.drawString("Broken Image", 6, 50);
g2d.dispose();
brokenLinkImg = new RedRable(GraphicsUtil.wrap(bi));
return brokenLinkImg;
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:31,代码来源:DefaultBrokenLinkProvider.java
示例18: fixAlpha
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public void fixAlpha(BufferedImage bi) {
if ((!bi.getColorModel().hasAlpha()) ||
(!bi.isAlphaPremultiplied()))
// No need to fix alpha if it isn't premultiplied...
return;
if (GraphicsUtil.is_INT_PACK_Data(bi.getSampleModel(), true))
fixAlpha_INT_PACK(bi.getRaster());
else
fixAlpha_FALLBACK(bi.getRaster());
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:11,代码来源:ConvolveMatrixRable8Bit.java
示例19: 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;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:AffineRable8Bit.java
示例20: createRendering
import org.apache.batik.ext.awt.image.GraphicsUtil; //导入依赖的package包/类
public RenderedImage createRendering(RenderContext rc) {
//
// Get source's rendered image
//
RenderedImage srcRI = getSource().createRendering(rc);
if(srcRI == null)
return null;
CachableRed srcCR = GraphicsUtil.wrap(srcRI);
return new ProfileRed(srcCR, colorSpace);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:13,代码来源:ProfileRable.java
注:本文中的org.apache.batik.ext.awt.image.GraphicsUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论