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


Java ParameterBlock.getFloatParameter方法代码示例

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


在下文中一共展示了ParameterBlock.getFloatParameter方法的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);

       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

示例2: mapRenderContext

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
    * Maps the output RenderContext into the RenderContext for the ith
    * source.
    * This method satisfies the implementation of CRIF.
    *
    * @param i               The index of the source image.
    * @param renderContext   The renderContext being applied to the operation.
    * @param paramBlock      The ParameterBlock containing the sources
    *                        and the translation factors.
    * @param image           The RenderableImageOp from which this method
    *                        was called.
    */
   public RenderContext mapRenderContext(int i,
                                         RenderContext renderContext,
				  ParameterBlock paramBlock,
				  RenderableImage image) {
       float x_center = paramBlock.getFloatParameter(0);
       float y_center = paramBlock.getFloatParameter(1);
       float angle = paramBlock.getFloatParameter(2);

       AffineTransform rotate =
           AffineTransform.getRotateInstance(angle, x_center, y_center);

       RenderContext RC = (RenderContext)renderContext.clone();
       AffineTransform usr2dev = RC.getTransform();
       usr2dev.concatenate(rotate);
RC.setTransform(usr2dev);
return RC;
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:30,代码来源:RotateCRIF.java

示例3: validateParameters

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Validates the input parameters.
 *
 * <p> In addition to the standard checks performed by the
 * superclass method, this method checks that "xScale" and "yScale"
 * are both greater than 0.
 */
protected boolean validateParameters(ParameterBlock args,
                                     StringBuffer msg) {
    if (!super.validateParameters(args, msg)) {
        return false;
    }

    float xScale = args.getFloatParameter(0);
    float yScale = args.getFloatParameter(1);
    if (xScale <= 0 || yScale <= 0) {
        msg.append(getName() + " " +
                   JaiI18N.getString("ScaleDescriptor6"));
 return false;
    }

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

示例4: getBounds2D

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Gets the bounding box for output of <code>TranslateOpImage</code>.
 * This method satisfies the implementation of CRIF.
 */
public Rectangle2D getBounds2D(ParameterBlock paramBlock) {
    RenderableImage source = paramBlock.getRenderableSource(0);
    float xTrans = paramBlock.getFloatParameter(0);
    float yTrans = paramBlock.getFloatParameter(1);

    return new Rectangle2D.Float(source.getMinX() + xTrans,
                                 source.getMinY() + yTrans,
                                 source.getWidth(),
                                 source.getHeight());
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:15,代码来源:TranslateCRIF.java

示例5: mapRenderContext

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
    * Maps the output RenderContext into the RenderContext for the ith
    * source.
    * This method satisfies the implementation of CRIF.
    *
    * @param i               The index of the source image.
    * @param renderContext   The renderContext being applied to the operation.
    * @param paramBlock      The ParameterBlock containing the sources
    *                        and the translation factors.
    * @param image           The RenderableImageOp from which this method
    *                        was called.
    */
   public RenderContext mapRenderContext(int i,
                                         RenderContext renderContext,
				  ParameterBlock paramBlock,
				  RenderableImage image) {

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

       AffineTransform scale = new AffineTransform(scale_x, 0.0, 0.0, scale_y,
                                                   trans_x, trans_y);

       RenderContext RC = (RenderContext)renderContext.clone();
       AffineTransform usr2dev = RC.getTransform();
       usr2dev.concatenate(scale);
RC.setTransform(usr2dev);
return RC;
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:32,代码来源:ScaleCRIF.java

示例6: create

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Creates a new instance of <code>CropOpImage</code> in the
 * rendered layer.
 *
 * @param args   The source image and bounding rectangle
 * @param hints  Optionally contains destination image layout.
 */
public RenderedImage create(ParameterBlock args,
                            RenderingHints renderHints) {
    // Get the source image.
    RenderedImage src = (RenderedImage)args.getRenderedSource(0);

    // Get the parameters.
    float originX = args.getFloatParameter(0);
    float originY = args.getFloatParameter(1);
    float width   = args.getFloatParameter(2);
    float height  = args.getFloatParameter(3);

    // Return the OpImage.
    return new CropOpImage(src,
                           originX,
                           originY,
                           width,
                           height);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:26,代码来源:CropCRIF.java

示例7: mapRenderContext

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
    * Maps the output RenderContext into the RenderContext for the ith
    * source.
    * This method satisfies the implementation of CRIF.
    *
    * @param i               The index of the source image.
    * @param renderContext   The renderContext being applied to the operation.
    * @param paramBlock      The ParameterBlock containing the sources
    *                        and the translation factors.
    * @param image           The RenderableImageOp from which this method
    *                        was called.
    */
   public RenderContext mapRenderContext(int i,
                                         RenderContext renderContext,
				  ParameterBlock paramBlock,
				  RenderableImage image) {

float scale_x = paramBlock.getFloatParameter(0);
       float scale_y = paramBlock.getFloatParameter(1);

       AffineTransform scale = new AffineTransform(scale_x, 0.0, 0.0, scale_y,
                                                   0.0, 0.0);

       RenderContext RC = (RenderContext)renderContext.clone();
       AffineTransform usr2dev = RC.getTransform();
       usr2dev.concatenate(scale);
RC.setTransform(usr2dev);
return RC;
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:30,代码来源:SubsampleBinaryToGrayCRIF.java

示例8: getBounds2D

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
    * Gets the bounding box for the output of <code>SubsampleBinaryToGrayOpImage</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);

// 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;
float d_y0 = y0 * scale_y;
float d_w = w * scale_x;
float d_h = h * scale_y;

// debugging
// System.out.println("*** CRIF getBounds2D() ");

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

示例9: validateRenderableArgs

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Validates the input source and parameters in the renderable mode.
 *
 * <p> In addition to the standard checks performed by the
 * superclass method, this method checks that "x", "y", "width",
 * and "height" form a rectangle that is not empty and that
 * is fully contained within the bounds of the source image.
 */
private boolean validateRenderableArgs(ParameterBlock args,
                                           StringBuffer msg) {
    // Get parameters.
    float x_req = args.getFloatParameter(0);
    float y_req = args.getFloatParameter(1);
    float w_req = args.getFloatParameter(2);
    float h_req = args.getFloatParameter(3);

    // Create required rectangle.
    Rectangle2D rect_req =
        new Rectangle2D.Float(x_req, y_req, w_req, h_req);

    // Check for an empty rectangle.
    if(rect_req.isEmpty()) {
        msg.append(getName() + " " +
                   JaiI18N.getString("CropDescriptor5"));
        return false;
    }

    // Check for out-of-bounds
    RenderableImage src = (RenderableImage)args.getSource(0);

    Rectangle2D rect_src =
        new Rectangle2D.Float(src.getMinX(),
                              src.getMinY(),
                              src.getWidth(),
                              src.getHeight());

    if (!rect_src.contains(rect_req)) {
        msg.append(getName() + " " +
                   JaiI18N.getString("CropDescriptor6"));
        return false;
    }

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

示例10: getBounds2D

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Returns the bounding box for the output of the operation.
 *
 * @param paramBlock A <code>ParameterBlock</code> containing the
 *        renderable sources and parameters of the operation.
 * @return A <code>Rectangle2D</code> specifying the bounding box.
 */
public Rectangle2D getBounds2D(ParameterBlock paramBlock) {
    // Return a rectangle representing the desired bounds.
    return new Rectangle2D.Float(paramBlock.getFloatParameter(0),
                                 paramBlock.getFloatParameter(1),
                                 paramBlock.getFloatParameter(2),
                                 paramBlock.getFloatParameter(3));
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:15,代码来源:CropCRIF.java

示例11: validateRenderedArgs

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
    * Validates the input source and parameters in the rendered mode.
    *
    * <p> In addition to the standard checks performed by the
    * superclass method, this method checks that "x", "y", "width",
    * and "height" form a rectangle that is not empty and that
    * is fully contained within the bounds of the source image.
    */
   private boolean validateRenderedArgs(ParameterBlock args,
                                    StringBuffer msg) {

       // Get parameters.
       float x_req = args.getFloatParameter(0);
       float y_req = args.getFloatParameter(1);
       float w_req = args.getFloatParameter(2);
       float h_req = args.getFloatParameter(3);

       // Create required rectangle.
       Rectangle rect_req =
           (new Rectangle2D.Float(x_req, y_req, w_req, h_req)).getBounds();

       // Check for an empty rectangle.
       if(rect_req.isEmpty()) {
           msg.append(getName() + " " +
                      JaiI18N.getString("CropDescriptor5"));
           return false;
       }

       // Check for out-of-bounds
       RenderedImage src = (RenderedImage)args.getSource(0);

Rectangle srcBounds = 
  new Rectangle(src.getMinX(),
		src.getMinY(),
		src.getWidth(),
		src.getHeight());

       if (!srcBounds.contains(rect_req)) {
           msg.append(getName() + " " +
                      JaiI18N.getString("CropDescriptor6"));
           return false;
       }

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

示例12: validateParameters

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
    * Validates the input parameters.
    *
    * <p> In addition to the standard checks performed by the
    * superclass method, this method checks that "xScale" and "yScale"
    * are both greater than 0 and less than or equal to 1.
    *
    * <p> The src image must be a binary, a one band, one bit
    * per pixel image with a <code> MultiPixelPackedSampleModel</code>.
    */
   protected boolean validateParameters(ParameterBlock args,
                                        StringBuffer msg) {
       if (!super.validateParameters(args, msg)) {
           return false;
       }

       // Checks for source to be Binary and Dest Grayscale
       // to be in the RIF 

RenderedImage src = (RenderedImage)args.getSource(0);

PixelAccessor srcPA = new PixelAccessor(src);
if (!srcPA.isPacked || !srcPA.isMultiPixelPackedSM){
           msg.append(getName() + " " +
                      JaiI18N.getString("SubsampleBinaryToGray3"));
    return false;	  
}

       float xScale = args.getFloatParameter(0);
       float yScale = args.getFloatParameter(1);
       if (xScale <= 0.0F || yScale <= 0.0F || xScale > 1.0F || yScale > 1.0F) {
           msg.append(getName() + " " +
                      JaiI18N.getString("SubsampleBinaryToGray1") + " or " +
                      JaiI18N.getString("SubsampleBinaryToGray2"));
    return false;
       }

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

示例13: create

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Creates a new instance of <code>ConstantOpImage</code>
 * in the renderable layer. This method satisfies the
 * implementation of CRIF.
 *
 * @pram renderContext  Rendering information.
 * @param paramBlock    The image layout for the output of
 *                      <code>ConstantOpImage</code>
 *                      and the constant pixel value.
 */
public RenderedImage create(RenderContext renderContext,
                            ParameterBlock paramBlock) {
    float minX = 0;
    float minY = 0;
    float width = paramBlock.getFloatParameter(0);
    float height = paramBlock.getFloatParameter(1);
    Number[] bandValues = (Number[])paramBlock.getObjectParameter(2);

    AffineTransform trans = renderContext.getTransform();
    float maxX, maxY;
    float[] ptSrc = new float[8];
    float[] ptDst = new float[8];

    ptSrc[0] = minX;
    ptSrc[1] = minY;
    ptSrc[2] = minX + width;
    ptSrc[3] = minY;
    ptSrc[4] = minX + width;
    ptSrc[5] = minY + height;
    ptSrc[6] = minX;
    ptSrc[7] = minY + height;
    trans.transform(ptSrc, 0, ptDst, 0, 4);
    
    minX = Math.min(ptDst[0], ptDst[2]);
    minX = Math.min(minX, ptDst[4]);
    minX = Math.min(minX, ptDst[6]);

    maxX = Math.max(ptDst[0], ptDst[2]);
    maxX = Math.max(maxX, ptDst[4]);
    maxX = Math.max(maxX, ptDst[6]);

    minY = Math.min(ptDst[1], ptDst[3]);
    minY = Math.min(minY, ptDst[5]);
    minY = Math.min(minY, ptDst[7]);

    maxY = Math.max(ptDst[1], ptDst[3]);
    maxY = Math.max(maxY, ptDst[5]);
    maxY = Math.max(maxY, ptDst[7]);

    int iMinX = (int)minX;
    int iMinY = (int)minY;
    int iWidth = (int)maxX - iMinX;
    int iHeight = (int)maxY - iMinY;

    return new ConstantOpImage(iMinX, iMinY, iWidth, iHeight,
                               Math.min(iWidth, DEFAULT_TILE_SIZE),
                               Math.min(iHeight, DEFAULT_TILE_SIZE),
                               bandValues);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:60,代码来源:ConstantCRIF.java

示例14: createRenderable

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Creates a RenderableImage pyramid from the source and parameters.
 * If the down sampler operation chain does not decrease both the
 * width and height at a given level an IllegalArgumentException will
 * be thrown.
 *
 * @param paramBlock The ParameterBlock containing a single RenderedImage
 * source and parameters sufficient to create an image pyramid.
 */
private RenderableImage createRenderable(ParameterBlock paramBlock) {
    // Create the Hashtable "just in time".
    if(mresTable == null) {
        mresTable = new Hashtable();
    }

    // Check for a SoftReference hashed on a ParameterBlock-derived key.
    Object key = getKey(paramBlock);
    SoftReference ref = (SoftReference)mresTable.get(key);

    // Retrieve the image from the SoftReference if possible.
    RenderableImage mres = null;
    if(ref != null && (mres = (RenderableImage)ref.get()) == null) {
        // null referent: remove the ParameterBlock key from the Hashtable.
        mresTable.remove(key);
    }

    // Derive the image if necessary.
    if(mres == null) {
        // Retrieve the source and parameters.
        RenderedImage source = paramBlock.getRenderedSource(0);
        RenderedOp downSampler =
            (RenderedOp)paramBlock.getObjectParameter(0);
        int maxLowResDim = paramBlock.getIntParameter(1);
        float minX = paramBlock.getFloatParameter(2);
        float minY = paramBlock.getFloatParameter(3);
        float height = paramBlock.getFloatParameter(4);

        // Create an image pyramid.
        ImageMIPMap pyramid = new ImageMIPMap(source, downSampler);

        // Create a Vector of RenderedImages from the pyramid.
        Vector sourceVector = new Vector();
        RenderedImage currentImage = pyramid.getCurrentImage();
        sourceVector.add(currentImage);
        while(currentImage.getWidth() > maxLowResDim ||
              currentImage.getHeight() > maxLowResDim) {
            RenderedImage nextImage = pyramid.getDownImage();
            if(nextImage.getWidth() >= currentImage.getWidth() ||
               nextImage.getHeight() >= currentImage.getHeight()) {
                throw new IllegalArgumentException(JaiI18N.getString("RenderableCRIF0"));
            }
            sourceVector.add(nextImage);
            currentImage = nextImage;
        }

        // Create a RenderableImage
        mres = new MultiResolutionRenderableImage(sourceVector,
                                                  minX, minY, height);

        // Store a SoftReference to the RenderableImage in the Hashtable.
        mresTable.put(key, new SoftReference(mres));
    }

    return mres;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:66,代码来源:RenderableCRIF.java

示例15: create

import java.awt.image.renderable.ParameterBlock; //导入方法依赖的package包/类
/**
 * Creates a new instance of ImageFunctionOpImage in the rendered layer.
 * This method satisfies the implementation of RIF.
 *
 * @param paramBlock  The source image, the X and Y scale factor,
 *                    and the interpolation method for resampling.
 */
public RenderedImage create(ParameterBlock paramBlock,
                            RenderingHints renderHints) {
    // Get ImageLayout from renderHints if any.
    ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
    

    ImageFunction function =
        (ImageFunction)paramBlock.getObjectParameter(0);

    // Ascertain that a supplied SampleModel has the requisite
    // number of bands vis-a-vis the ImageFunction.
    int numBandsRequired = function.isComplex() ?
        function.getNumElements() * 2 : function.getNumElements();
    if(layout != null &&
       layout.isValid(ImageLayout.SAMPLE_MODEL_MASK) &&
       layout.getSampleModel(null).getNumBands() != numBandsRequired ) {
        throw new RuntimeException(JaiI18N.getString("ImageFunctionRIF0"));
    }

    int minX = 0;
    int minY = 0;
    if (layout != null) {
        if (layout.isValid(ImageLayout.MIN_X_MASK)) {
            minX = layout.getMinX(null);
        }
        if (layout.isValid(ImageLayout.MIN_Y_MASK)) {
            minY = layout.getMinX(null);
        }
    }

    int width = paramBlock.getIntParameter(1);
    int height = paramBlock.getIntParameter(2);
    float xScale = paramBlock.getFloatParameter(3);
    float yScale = paramBlock.getFloatParameter(4);
    float xTrans = paramBlock.getFloatParameter(5);
    float yTrans = paramBlock.getFloatParameter(6);

    return new ImageFunctionOpImage(function,
                                    minX, minY,
                                    width, height,
                                    xScale, yScale,
                                    xTrans, yTrans,
                                    renderHints, layout);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:52,代码来源:ImageFunctionRIF.java


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