当前位置: 首页>>代码示例>>Java>>正文


Java RenderableImage类代码示例

本文整理汇总了Java中java.awt.image.renderable.RenderableImage的典型用法代码示例。如果您正苦于以下问题:Java RenderableImage类的具体用法?Java RenderableImage怎么用?Java RenderableImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RenderableImage类属于java.awt.image.renderable包,在下文中一共展示了RenderableImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * The handler sets the xlink:href tag and returns a transform
 */
public AffineTransform handleImage(RenderableImage image,
                                   Element imageElement,
                                   double x, double y,
                                   double width, double height,
                                   SVGGeneratorContext generatorContext) {

    double imageWidth   = image.getWidth();
    double imageHeight  = image.getHeight();

    if(imageWidth == 0 || imageHeight == 0 ||
       width == 0 || height == 0) {

        // Forget about it
        handleEmptyImage(imageElement);

    } else {
        imageHandler.handleImage(image, imageElement, generatorContext);
        setImageAttributes(imageElement, x, y, width, height, generatorContext);
    }
    return null;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:SimpleImageHandler.java

示例2: drawImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * Draws a <code>Filter</code> (<code>RenderableImage</code>) into a
 * Graphics 2D.<p>
 *
 * This method also attempts to unwind the rendering chain a bit.
 * So it knows about certain operations (like affine, pad,
 * composite), rather than applying each of these operations in
 * turn it accounts for their affects through modifications to the
 * Graphics2D.  This avoids generating lots of intermediate images.
 *
 * @param g2d    The Graphics to draw into.
 * @param filter The filter to draw
 */
public static void drawImage(Graphics2D g2d,
                             RenderableImage filter) {
    if (filter instanceof PaintRable) {
        PaintRable pr = (PaintRable)filter;
        if (pr.paintRable(g2d))
            // paintRable succeeded so we are done...
            return;
    }

    // Get our sources image...
    // System.out.println("UnOpt: " + filter);
    AffineTransform at = g2d.getTransform();
    RenderedImage ri = filter.createRendering
        (new RenderContext(at, g2d.getClip(), g2d.getRenderingHints()));

    if (ri == null)
        return;

    g2d.setTransform(IDENTITY);
    drawImage(g2d, GraphicsUtil.wrap(ri));
    g2d.setTransform(at);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:36,代码来源:GraphicsUtil.java

示例3: handleHREF

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * This method will delegate to the <tt>handleHREF</tt> which
 * uses a <tt>RenderedImage</tt>
 */
protected void handleHREF(RenderableImage image, Element imageElement,
                          SVGGeneratorContext generatorContext)
    throws SVGGraphics2DIOException {
    // Create an buffered image where the image will be drawn
    Dimension size = new Dimension((int)Math.ceil(image.getWidth()),
                                   (int)Math.ceil(image.getHeight()));
    BufferedImage buf = buildBufferedImage(size);

    Graphics2D g = createGraphics(buf);

    g.drawRenderableImage(image, IDENTITY);
    g.dispose();

    handleHREF((RenderedImage)buf, imageElement, generatorContext);
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:20,代码来源:DefaultCachedImageHandler.java

示例4: drawImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * Draws a <tt>Filter</tt> (<tt>RenderableImage</tt>) into a
 * Graphics 2D.<p>
 *
 * This method also attempts to unwind the rendering chain a bit.
 * So it knows about certain operations (like affine, pad,
 * composite), rather than applying each of these operations in
 * turn it accounts for their affects through modifications to the
 * Graphics2D.  This avoids generating lots of intermediate images.
 *
 * @param g2d    The Graphics to draw into.
 * @param filter The filter to draw
 */
public static void drawImage(Graphics2D g2d,
                             RenderableImage filter) {
    if (filter instanceof PaintRable) {
        PaintRable pr = (PaintRable)filter;
        if (pr.paintRable(g2d))
            // paintRable succeeded so we are done...
            return;
    }

    // Get our sources image...
    // System.out.println("UnOpt: " + filter);
    AffineTransform at = g2d.getTransform();
    RenderedImage ri = filter.createRendering
        (new RenderContext(at, g2d.getClip(), g2d.getRenderingHints()));

    if (ri == null)
        return;

    g2d.setTransform(IDENTITY);
    drawImage(g2d, GraphicsUtil.wrap(ri));
    g2d.setTransform(at);
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:36,代码来源:GraphicsUtil.java

示例5: getBounds2D

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
    * Gets the bounding box for the output of <code>ScaleOpImage</code>.
    * This method satisfies the implementation of CRIF.
    */
   public Rectangle2D getBounds2D(ParameterBlock paramBlock) {        

       RenderableImage source = paramBlock.getRenderableSource(0);

       double scaleX = paramBlock.getDoubleParameter(0);
       double scaleY = paramBlock.getDoubleParameter(1);

// Get the source dimensions
float x0 = (float)source.getMinX();
float y0 = (float)source.getMinY() ;
float w = (float)source.getWidth();
float h = (float)source.getHeight();

// Forward map the source using x0, y0, w and h
float d_x0 = (float)(x0 * scaleX);
float d_y0 = (float)(y0 * scaleY);
float d_w = (float)(w * scaleX);
float d_h = (float)(h * scaleY);

return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h);
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:26,代码来源:SubsampleAverageCRIF.java

示例6: getBounds2D

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
    * Gets the bounding box for the output of <code>ScaleOpImage</code>.
    * This method satisfies the implementation of CRIF.
    */
   public Rectangle2D getBounds2D(ParameterBlock paramBlock) {        

       RenderableImage source = paramBlock.getRenderableSource(0);

       float scale_x = paramBlock.getFloatParameter(0);
       float scale_y = paramBlock.getFloatParameter(1);
       float trans_x = paramBlock.getFloatParameter(2);
       float trans_y = paramBlock.getFloatParameter(3);
       Interpolation interp = (Interpolation)paramBlock.getObjectParameter(4);

// Get the source dimensions
float x0 = (float)source.getMinX();
float y0 = (float)source.getMinY() ;
float w = (float)source.getWidth();
float h = (float)source.getHeight();

// Forward map the source using x0, y0, w and h
float d_x0 = x0 * scale_x + trans_x;
float d_y0 = y0 * scale_y + trans_y;
float d_w = w * scale_x;
float d_h = h * scale_y;

return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h);
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:29,代码来源:ScaleCRIF.java

示例7: handleHREF

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * This template method should set the xlink:href attribute on the input
 * Element parameter
 */
protected void handleHREF(RenderableImage image, Element imageElement,
                          SVGGeneratorContext generatorContext)
    throws SVGGraphics2DIOException {
    // Create an buffered image where the image will be drawn
    Dimension size = new Dimension((int)Math.ceil(image.getWidth()),
                                   (int)Math.ceil(image.getHeight()));
    BufferedImage buf = buildBufferedImage(size);

    Graphics2D g = createGraphics(buf);

    g.drawRenderableImage(image, IDENTITY);
    g.dispose();

    // Save image into file
    saveBufferedImageToFile(imageElement, buf, generatorContext);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:AbstractImageHandlerEncoder.java

示例8: handleHREF

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * The handler should set the xlink:href tag and the width and
 * height attributes.
 */
public void handleHREF(RenderableImage image, Element imageElement,
                          SVGGeneratorContext generatorContext)
    throws SVGGraphics2DIOException {
    if (image == null){
        throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL);
    }

    RenderedImage r = image.createDefaultRendering();
    if (r == null) {
        handleEmptyImage(imageElement);
    } else {
        handleHREF(r, imageElement, generatorContext);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:19,代码来源:ImageHandlerBase64Encoder.java

示例9: handleImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * The handler sets the xlink:href tag and returns a transform
 */
public AffineTransform handleImage(RenderableImage image,
                                   Element imageElement,
                                   double x, double y,
                                   double width, double height,
                                   SVGGeneratorContext generatorContext) {

    double imageWidth   = image.getWidth();
    double imageHeight  = image.getHeight();
    AffineTransform af  = null;

    if(imageWidth == 0 || imageHeight == 0 ||
       width == 0 || height == 0) {

        // Forget about it
        handleEmptyImage(imageElement);

    } else {
        // First set the href
        try {
            handleHREF(image, imageElement, generatorContext);
        } catch (SVGGraphics2DIOException e) {
            try {
                generatorContext.errorHandler.handleError(e);
            } catch (SVGGraphics2DIOException io) {
                // we need a runtime exception because
                // java.awt.Graphics2D method doesn't throw exceptions..
                throw new SVGGraphics2DRuntimeException(io);
            }
        }

        // Then create the transformation:
        // Because we cache image data, the stored image may
        // need to be scaled.
        af = handleTransform(imageElement, x,y,
                             imageWidth, imageHeight,
                             width, height, generatorContext);
    }
    return af;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:43,代码来源:DefaultCachedImageHandler.java

示例10: handleHREF

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * This method will delegate to the <code>handleHREF</code> which
 * uses a <code>RenderedImage</code>
 */
protected void handleHREF(RenderableImage image, Element imageElement,
                          SVGGeneratorContext generatorContext)
    throws SVGGraphics2DIOException {
    // Create an buffered image where the image will be drawn
    Dimension size = new Dimension((int)Math.ceil(image.getWidth()),
                                   (int)Math.ceil(image.getHeight()));
    BufferedImage buf = buildBufferedImage(size);

    Graphics2D g = createGraphics(buf);

    g.drawRenderableImage(image, IDENTITY);
    g.dispose();

    handleHREF((RenderedImage)buf, imageElement, generatorContext);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:DefaultCachedImageHandler.java

示例11: handleImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * The handler should set the xlink:href tag and the width and
 * height attributes.
 */
public void handleImage(RenderableImage image, Element imageElement,
                        SVGGeneratorContext generatorContext) {
    //
    // First, set the image width and height
    //
    imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE,  String.valueOf( image.getWidth() ) );
    imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) );

    //
    // Now, set the href
    //
    try {
        handleHREF(image, imageElement, generatorContext);
    } catch (SVGGraphics2DIOException e) {
        try {
            generatorContext.errorHandler.handleError(e);
        } catch (SVGGraphics2DIOException io) {
            // we need a runtime exception because
            // java.awt.Graphics2D method doesn't throw exceptions..
            throw new SVGGraphics2DRuntimeException(io);
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:28,代码来源:DefaultImageHandler.java

示例12: allPaintRable

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * This returns true if <code>ri</code> and all of <code>ri</code>'s
 * sources implement the PaintRable interface.  This is used to
 * indicate that the chain has a good potential for bypassing the
 * filterRes operation entirely.
 *
 * Ideally there would be a checkPaintRable method in PaintRable
 * that could be used to get a definate answer about a filters
 * ability to draw directly to a Graphics2D (this can sometimes
 * 'fail' because of the way the Graphics2D is currently
 * configured).
 */
public boolean allPaintRable(RenderableImage ri) {
    if (!(ri instanceof PaintRable))
        return false;

    List v = ri.getSources();
    // No sources and we are PaintRable so the chain is PaintRable.
    if (v == null) return true;

    Iterator i = v.iterator();
    while (i.hasNext()) {
        RenderableImage nri = (RenderableImage)i.next();
        // A source is not paintRable so we are not 100% paintRable.
        if (!allPaintRable(nri)) return false;
    }

    return true;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:30,代码来源:FilterResRable8Bit.java

示例13: getPropertyNames

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
public String [] getPropertyNames() {
    Set keys = props.keySet();
    Iterator iter = keys.iterator();
    String[] ret  = new String[keys.size()];
    int i=0;
    while (iter.hasNext()) {
        ret[i++] = (String)iter.next();
    }

    iter = srcs.iterator();
    while (iter.hasNext()) {
        RenderableImage ri = (RenderableImage)iter.next();
        String [] srcProps = ri.getPropertyNames();
        if (srcProps.length != 0) {
            String [] tmp = new String[ret.length+srcProps.length];
            System.arraycopy(ret,0,tmp,0,ret.length);
            System.arraycopy(tmp,ret.length,srcProps,0,srcProps.length);
            ret = tmp;
        }
    }

    return ret;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:AbstractRable.java

示例14: drawRenderableImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * Renders a renderable image. This produces a RenderedImage, which is
 * then passed to {@link #drawRenderedImage(RenderedImage, AffineTransform)}
 * to perform the final rendering.
 *
 * @param image the renderable image to be rendered
 * @param xform the transform from image space to user space
 */
public void drawRenderableImage(RenderableImage image, AffineTransform xform)
{
  Rectangle areaOfInterest = new Rectangle((int) image.getMinX(),
                                           (int) image.getHeight(),
                                           (int) image.getWidth(),
                                           (int) image.getHeight());
  drawRenderableImageImpl(image, xform, areaOfInterest);

}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:AbstractGraphics2D.java

示例15: drawRenderableImage

import java.awt.image.renderable.RenderableImage; //导入依赖的package包/类
/**
 * Renders a renderable image. This produces a RenderedImage, which is
 * then passed to {@link #drawRenderedImage(RenderedImage, AffineTransform)}
 * to perform the final rendering.
 *
 * @param image the renderable image to be rendered
 * @param xform the transform from image space to user space
 */
public void drawRenderableImage(RenderableImage image, AffineTransform xform)
{
  Rectangle areaOfInterest = new Rectangle((int) image.getMinX(),
                                           (int) image.getHeight(),
                                           (int) image.getWidth(),
                                           (int) image.getHeight());
  drawRenderableImageImpl(image, xform, areaOfInterest);
                                                     
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:18,代码来源:AbstractGraphics2D.java


注:本文中的java.awt.image.renderable.RenderableImage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。