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


Java ParameterBlock类代码示例

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


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

示例1: getBounds2D

import java.awt.image.renderable.ParameterBlock; //导入依赖的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

示例2: validateParameters

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
/**
 * Validates the input parameter.
 *
 * <p> In addition to the standard checks performed by the
 * superclass method, this method checks that the length of the
 * "constants" array is at least 1.
 */
protected boolean validateParameters(ParameterBlock args,
                                     StringBuffer message) {
    if (!super.validateParameters(args, message)) {
        return false;
    }

    int length = ((double[])args.getObjectParameter(0)).length;
    if (length < 1) {
        message.append(getName() + " " +
                       JaiI18N.getString("MultiplyConstDescriptor2"));
        return false;
    }

    return true;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:23,代码来源:MultiplyConstDescriptor.java

示例3: convertColorModel

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
private PlanarImage convertColorModel(PlanarImage pi) {
    int numComponents = pi.getColorModel().getNumComponents();
    boolean isGrey = numComponents == 1;
    ColorModel colorModel = rgbColorModel;
    if (isGrey) colorModel = grayColorModel;
    try {
        ParameterBlock pb = new ParameterBlock();
        pb.addSource(pi).add(colorModel);
        RenderedOp dst = JAI.create("ColorConvert", pb);
        return dst.getRendering();
    } catch (IllegalArgumentException ex) {
        logger.info("Error: Cannot convert color model. Original color model: " + pi.getColorModel());
        return null;
    }

}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:17,代码来源:OrbitTiledImage2.java

示例4: adjustBrightness

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
public static PlanarImage adjustBrightness(PlanarImage src, final double b) {
    final double[][] matrixRGB = {
            {1d, 0D, 0D, b},
            {0D, 1d, 0D, b},
            {0, 0D, 1d, b}

    };


    final double[][] matrixGrey = {
            {1d, b}
    };

    double[][] matrix;
    if (src.getSampleModel().getNumBands() > 1)
        matrix = matrixRGB;
    else matrix = matrixGrey;


    ParameterBlock pb = new ParameterBlock();
    pb.addSource(src);
    pb.add(matrix);
    return JAI.create("bandcombine", pb);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:25,代码来源:OrbitTiledImage2.java

示例5: graphicFillLineString

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
private static void graphicFillLineString(final LineSymbolizer symbolizer, final Shape shape, final Image image, final float size, final double opacity) {
    Double width = new Double(Math.max(1, shape.getBounds2D().getWidth()));
    Double height = new Double(Math.max(1, shape.getBounds2D().getHeight()));
    Double shapeHeight = new Double(size);
    double factor = shapeHeight.doubleValue() / image.getHeight(null);
    Double shapeWidth = new Double(image.getWidth(null) * factor);
    AffineTransform transform = AffineTransform.getTranslateInstance(shape.getBounds2D().getMinX(), shape.getBounds2D().getMinY());
    Image scaledImage = image.getScaledInstance(shapeWidth.intValue(), shapeHeight.intValue(), Image.SCALE_FAST);
    BufferedImage buff = new BufferedImage(shapeWidth.intValue(), shapeHeight.intValue(), BufferedImage.TYPE_INT_ARGB);
    buff.getGraphics().drawImage(scaledImage, 0, 0, null);
    ParameterBlock p = new ParameterBlock();
    p.addSource(buff);
    p.add(width.intValue());
    p.add(height.intValue());
    RenderedOp im = JAI.create("pattern", p);//$NON-NLS-1$
    BufferedImage bufferedImage = im.getAsBufferedImage();
    glDrawImage(bufferedImage, transform, null);
    bufferedImage.flush();
    im.dispose();
    scaledImage.flush();
    buff.flush();
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:23,代码来源:RenderGL11Util.java

示例6: drawGraphicFillPolygon

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
private static void drawGraphicFillPolygon(Image image, float size, Graphics2D graphics, double opacity, double widthSymbol, double heightSymbol, double offsetYSymbol, double offsetXSymbol) {
    Double shapeHeight = new Double(size);
    double factor = shapeHeight / image.getHeight(null);
    Double shapeWidth = new Double(Math.max(image.getWidth(null) * factor, 1));
    AffineTransform transform = AffineTransform.getTranslateInstance(offsetXSymbol, offsetYSymbol);
    Image scaledImage = image.getScaledInstance(shapeWidth.intValue(), shapeHeight.intValue(), Image.SCALE_FAST);
    BufferedImage buff = new BufferedImage(shapeWidth.intValue(), shapeHeight.intValue(), BufferedImage.TYPE_INT_ARGB);
    buff.getGraphics().drawImage(scaledImage, 0, 0, null);
    ParameterBlock p = new ParameterBlock();
    p.addSource(buff);
    p.add((int) widthSymbol);
    p.add((int) heightSymbol);
    RenderedOp im = JAI.create("pattern", p);//$NON-NLS-1$
    BufferedImage bufferedImage = im.getAsBufferedImage();
    graphics.drawImage(bufferedImage, transform, null);
    bufferedImage.flush();
    im.dispose();
    scaledImage.flush();
    buff.flush();
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:21,代码来源:LayerStylesPanel.java

示例7: computeEdgeDensityClutter

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
private double computeEdgeDensityClutter(PlanarImage image) {
  // first compute the RenderedOp that computes both vertical and
  // horizontal
  // edge detection
  KernelJAI sobelVertKernel = KernelJAI.GRADIENT_MASK_SOBEL_VERTICAL;
  KernelJAI sobelHorizKernel = KernelJAI.GRADIENT_MASK_SOBEL_HORIZONTAL;
  ParameterBlock pb = new ParameterBlock();
  pb.addSource(image);
  pb.add(sobelHorizKernel);
  pb.add(sobelVertKernel);
  RenderedOp renderedOp = JAI.create("gradientmagnitude", pb);
  BufferedImage edgeImage = renderedOp.getAsBufferedImage();

  // then compute a density value, i.e. the mean
  int edgeTotal = 0;
  for (int i = 0; i < edgeImage.getWidth(); i++)
    for (int j = 0; j < edgeImage.getHeight(); j++)
      edgeTotal += Math.abs(edgeImage.getRGB(i, j));

  return Math.abs(edgeTotal / (edgeImage.getWidth() * edgeImage.getHeight()));
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:22,代码来源:RasterClutterMethod.java

示例8: addBorder

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
/**
 * add a border to image
 * @param thickness
 * @param color
 * @param borderType 
 */
public void addBorder(int thickness, Color color, int borderType)  throws ExpressionException{
	
	double colorArray[] = {color.getRed(), color.getGreen(), color.getBlue()};
	BorderExtender borderExtender = new BorderExtenderConstant(colorArray);
	
	ParameterBlock params = new ParameterBlock();
	params.addSource(image());
	params.add(thickness);
	params.add(thickness);
	params.add(thickness);
	params.add(thickness);
	if(BORDER_TYPE_CONSTANT==borderType)	params.add(borderExtender);
	else 	params.add(BorderExtender.createInstance(borderType));
	//else if(BORDER_TYPE_WRAP==borderType)params.add(BorderExtender.createInstance(BorderExtender.BORDER_REFLECT));

	image((JAI.create("border", params)).getAsBufferedImage());
	
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:25,代码来源:Image.java

示例9: translate

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
public void translate(int xtrans, int ytrans, Object interpolation) throws ExpressionException {
	
	RenderingHints hints = new RenderingHints(RenderingHints.KEY_INTERPOLATION,interpolation);
	if(interpolation!=RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR) {
		hints.add(new RenderingHints(JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(1)));
	}
	
	ParameterBlock pb = new ParameterBlock();
	pb.addSource(image());
	BufferedImage img = JAI.create("translate", pb).getAsBufferedImage();
	Graphics2D graphics = img.createGraphics();
	graphics.clearRect(0, 0, img.getWidth(), img.getHeight());
	AffineTransform at = new AffineTransform();
	at.setToIdentity();
	graphics.drawImage(image(), new AffineTransformOp(at, hints), xtrans, ytrans);
	graphics.dispose();
	image(img);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:19,代码来源:Image.java

示例10: _rotate

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
public void _rotate(float x, float y, float angle, String interpolation) throws ExpressionException {

		float radiansAngle = (float)Math.toRadians(angle);

		// rotation center
		float centerX = (float)getWidth() / 2;
		float centerY = (float)getHeight() / 2;
		
		ParameterBlock pb = new ParameterBlock();
		pb.addSource(image());
		pb.add(centerX);
		pb.add(centerY);
		pb.add(radiansAngle);
		pb.add(new javax.media.jai.InterpolationBicubic(10));
		
		// create a new, rotated image
		image(JAI.create("rotate", pb).getAsBufferedImage());

	}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:20,代码来源:Image.java

示例11: crop

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
public void crop(float x, float y, float width, float height) throws ExpressionException {
	ParameterBlock params = new ParameterBlock();
	params.addSource(image());
	params.add(x);
	params.add(y);

	float w = getWidth();
	float h = getHeight();
	
	if (w < x + width) params.add(w - x);
	else params.add(width);
	
	if (h < y + height) params.add(h - y);
	else params.add(height);
	
	image(JAI.create("crop", params).getAsBufferedImage());
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:18,代码来源:Image.java

示例12: blur

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
public void blur(int blurFactor)  throws ExpressionException{
    ParameterBlock params = new ParameterBlock();
	params.addSource(image());
	params.add(blurFactor);
	RenderingHints hint= new RenderingHints(JAI.KEY_BORDER_EXTENDER,BorderExtender.createInstance(1));
	image(JAI.create("boxfilter", params, hint).getAsBufferedImage());
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:8,代码来源:Image.java

示例13: performImageOp

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
/**
 * Transforms an ROI using an imaging operation.  The operation is
 * specified by a <code>RenderedImageFactory</code>.  The
 * operation's <code>ParameterBlock</code>, minus the image source
 * itself is supplied, along with an index indicating where to
 * insert the ROI image.  The <code>renderHints</code> argument
 * allows rendering hints to be passed in.
 *
 * @param RIF A <code>RenderedImageFactory</code> that will be used
 *        to create the op.
 * @param paramBlock A <code>ParameterBlock</code> containing all
 *        sources and parameters for the op except for the ROI itself.
 * @param sourceIndex The index of the <code>ParameterBlock</code>'s
 *        sources where the ROI is to be inserted.
 * @param renderHints A <code>RenderingHints</code> object containing
 *        rendering hints, or null.
 * @throws IllegalArgumentException if RIF is null.
 * @throws IllegalArgumentException if paramBlock is null.
 */
public ROI performImageOp(RenderedImageFactory RIF,
                          ParameterBlock paramBlock,
                          int sourceIndex,
                          RenderingHints renderHints) {

    if (  RIF == null || paramBlock == null ) {
        throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
    }

    // Clone the ParameterBlock and insert a source
    ParameterBlock pb = (ParameterBlock) paramBlock.clone();
    Vector sources = pb.getSources();
    sources.insertElementAt(this.getAsImage(), sourceIndex);

    // Create a new RenderedImage based on the RIF
    // and ParameterBlock.
    RenderedImage im = RIF.create(pb, renderHints);
    return new ROI(im, threshold);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:39,代码来源:ROI.java

示例14: ImageMIPMap

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
/**
 * Constructor.  The down sampler is an "affine" operation that
 * uses the supplied <code>AffineTransform</code> and
 * <code>Interpolation</code> objects.
 * All input parameters are saved by reference.
 *
 * @param image  The image with the highest resolution.
 * @param transform  An affine matrix used with an "affine" operation
 *        to derive the lower resolution images.
 * @param interpolation  The interpolation method for the "affine"
 *        operation.  It may be <code>null</code>, in which case the
 *        default "nearest neighbor" interpolation method is used.
 *
 * @throws IllegalArgumentException if <code>image</code> is
 *         <code>null</code>.
 * @throws IllegalArgumentException if <code>transform</code> is
 *         <code>null</code>.
 */
public ImageMIPMap(RenderedImage image,
                   AffineTransform transform,
                   Interpolation interpolation) {
    this();

    if ( image == null || transform == null ) {
        throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
    }

    ParameterBlock pb = new ParameterBlock();
    pb.addSource(image);
    pb.add(transform);
    pb.add(interpolation);

    downSampler = JAI.create("affine", pb);
    downSampler.removeSources();

    highestImage = image;
    currentImage = highestImage;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:39,代码来源:ImageMIPMap.java

示例15: AddConstToCollectionOpImage

import java.awt.image.renderable.ParameterBlock; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param sourceCollection  A collection of rendered images.
 * @param hints  Optionally contains destination image layout.
 * @param constants  The constants to be added, stored as reference.
 */
public AddConstToCollectionOpImage(Collection sourceCollection,
                                   RenderingHints hints,
                                   double[] constants) {
    /**
     * Try to create a new instance of the sourceCollection to be
     * used to store output images. If failed, use a Vector.
     */
    try {
        imageCollection =
            (Collection)sourceCollection.getClass().newInstance();
    } catch (Exception e) {
        imageCollection = new Vector();
    }

    Iterator iter = sourceCollection.iterator();
    while (iter.hasNext()) {
        ParameterBlock pb = new ParameterBlock();
        pb.addSource(iter.next());
        pb.add(constants);

        imageCollection.add(JAI.create("AddConst", pb, hints));
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:31,代码来源:AddConstToCollectionOpImage.java


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