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


Java Interpolation.getTopPadding方法代码示例

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


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

示例1: AffineGeneralOpImage

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
 * Constructs an AffineGeneralOpImage from a RenderedImage source,
 *
 * @param source a RenderedImage.
 * @param extender a BorderExtender, or null.

 * @param layout an ImageLayout optionally containing the tile grid layout,
 *        SampleModel, and ColorModel, or null.
 * @param interp an Interpolation object to use for resampling
 * @param transform the desired AffineTransform.
 */
public AffineGeneralOpImage(RenderedImage source,
                            BorderExtender extender,
                            Map config,
                            ImageLayout layout,
                            AffineTransform transform,
                            Interpolation interp,
double[] backgroundValues) {
    super(source,
          extender,
          config,
          layout,
          transform,
          interp,
   backgroundValues);

    subsampleBits = interp.getSubsampleBitsH();
    shiftvalue = 1 << subsampleBits;

    interp_width = interp.getWidth();
    interp_height = interp.getHeight();
    interp_left = interp.getLeftPadding();
    interp_top = interp.getTopPadding();
    interp_right = interp_width - interp_left - 1;
    interp_bottom = interp_height - interp_top - 1;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:37,代码来源:AffineGeneralOpImage.java

示例2: ScaleGeneralOpImage

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
    * Constructs a ScaleGeneralOpImage from a RenderedImage source,
    * 
    * @param source a RenderedImage.
    * @param extender a BorderExtender, or null.

    * @param layout an ImageLayout optionally containing the tile grid layout,
    *        SampleModel, and ColorModel, or null.
    * @param xScale scale factor along x axis.
    * @param yScale scale factor along y axis.
    * @param xTrans translation factor along x axis.
    * @param yTrans translation factor along y axis.
    * @param interp a Interpolation object to use for resampling.
    */
   public ScaleGeneralOpImage(RenderedImage source,
                              BorderExtender extender,
		       Map config,
                              ImageLayout layout,
		       float xScale,
		       float yScale,
		       float xTrans,
		       float yTrans,
		       Interpolation interp) {

       super(source,
             layout,
             config,
             true,
             extender,
             interp,
             xScale,
             yScale,
             xTrans,
             yTrans);

subsampleBits = interp.getSubsampleBitsH();

// Internal precision required for position calculations
one = 1 << subsampleBits;

// Get the width and height and padding of the Interpolation kernel.
interp_width = interp.getWidth();
interp_height = interp.getHeight();
interp_left = interp.getLeftPadding();
interp_top = interp.getTopPadding();

if (invScaleYRational.num > invScaleYRational.denom) {
    invScaleYInt = invScaleYRational.num / invScaleYRational.denom;
    invScaleYFrac = invScaleYRational.num % invScaleYRational.denom;
} else {
    invScaleYInt = 0;
    invScaleYFrac = invScaleYRational.num;
}

if (invScaleXRational.num > invScaleXRational.denom) {
    invScaleXInt = invScaleXRational.num / invScaleXRational.denom;
    invScaleXFrac = invScaleXRational.num % invScaleXRational.denom;
} else {
    invScaleXInt = 0;
    invScaleXFrac = invScaleXRational.num;
}
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:63,代码来源:ScaleGeneralOpImage.java

示例3: getProperty

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
 * Returns the specified property in the rendered layer.
 *
 * @param name   Property name.
 * @param opNode Operation node.
 */
public Object getProperty(String name,
                          Object opNode) {
    validate(name, opNode);

    if(opNode instanceof RenderedOp &&
       name.equalsIgnoreCase("roi")) {
        RenderedOp op = (RenderedOp)opNode;

        ParameterBlock pb = op.getParameterBlock();

        // Retrieve the rendered source image and its ROI.
        RenderedImage src = pb.getRenderedSource(0);
        Object property = src.getProperty("ROI");
        if (property == null ||
            property.equals(java.awt.Image.UndefinedProperty) ||
            !(property instanceof ROI)) {
            return java.awt.Image.UndefinedProperty;
        }
        ROI srcROI = (ROI)property;

        // Retrieve the Interpolation object.
        Interpolation interp = (Interpolation)pb.getObjectParameter(1);

        // Determine the effective source bounds.
        Rectangle srcBounds = null;
        PlanarImage dst = op.getRendering();
        if (dst instanceof GeometricOpImage &&
            ((GeometricOpImage)dst).getBorderExtender() == null) {
            srcBounds =
                new Rectangle(src.getMinX() + interp.getLeftPadding(),
                              src.getMinY() + interp.getTopPadding(),
                              src.getWidth() - interp.getWidth() + 1,
                              src.getHeight() - interp.getHeight() + 1);
        } else {
            srcBounds = new Rectangle(src.getMinX(),
	  src.getMinY(),
	  src.getWidth(),
	  src.getHeight());
        }

        // If necessary, clip the ROI to the effective source bounds.
        if (!srcBounds.contains(srcROI.getBounds())) {
            srcROI = srcROI.intersect(new ROIShape(srcBounds));
        }

        // Retrieve the AffineTransform object.
        AffineTransform transform =
            (AffineTransform)pb.getObjectParameter(0);

        // Create the transformed ROI.
        ROI dstROI = srcROI.transform((AffineTransform)transform);

        // Retrieve the destination bounds.
        Rectangle dstBounds = op.getBounds();

        // If necessary, clip the transformed ROI to the
        // destination bounds.
        if (!dstBounds.contains(dstROI.getBounds())) {
            dstROI = dstROI.intersect(new ROIShape(dstBounds));
        }

        // Return the transformed and possibly clipped ROI.
        return dstROI;
    }

    return java.awt.Image.UndefinedProperty;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:74,代码来源:AffineDescriptor.java

示例4: getProperty

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
 * Returns the specified property.
 *
 * @param name  Property name.
 * @param opNode Operation node.
 */
public Object getProperty(String name,
                          Object opNode) {
    validate(name, opNode);

    if(opNode instanceof RenderedOp &&
       name.equalsIgnoreCase("roi")) {
        RenderedOp op = (RenderedOp)opNode;

        ParameterBlock pb = op.getParameterBlock();

        // Retrieve the rendered source image and its ROI.
        RenderedImage src = pb.getRenderedSource(0);
        Object property = src.getProperty("ROI");
        if (property == null ||
            property.equals(java.awt.Image.UndefinedProperty) ||
            !(property instanceof ROI)) {
            return java.awt.Image.UndefinedProperty;
        }
        ROI srcROI = (ROI)property;

        // Retrieve the Interpolation object.
        Interpolation interp = (Interpolation)pb.getObjectParameter(3);

        // Determine the effective source bounds.
        Rectangle srcBounds = null;
        PlanarImage dst = op.getRendering();
        if (dst instanceof GeometricOpImage &&
            ((GeometricOpImage)dst).getBorderExtender() == null) {
            srcBounds =
                new Rectangle(src.getMinX() + interp.getLeftPadding(),
                              src.getMinY() + interp.getTopPadding(),
                              src.getWidth() - interp.getWidth() + 1,
                              src.getHeight() - interp.getHeight() + 1);
        } else {
            srcBounds = new Rectangle(src.getMinX(),
	  src.getMinY(),
	  src.getWidth(),
	  src.getHeight());
        }

        // If necessary, clip the ROI to the effective source bounds.
        if(!srcBounds.contains(srcROI.getBounds())) {
            srcROI = srcROI.intersect(new ROIShape(srcBounds));
        }

        // Retrieve the translation and rotation angle.
 double xorig = (double)pb.getFloatParameter(0);
 double yorig = (double)pb.getFloatParameter(1);
        double angle = (double)pb.getFloatParameter(2);

        // Create an transform representing the rotation.
        AffineTransform transform =
  AffineTransform.getRotateInstance(angle, xorig, yorig);

        // Create the rotated/translated ROI.
        ROI dstROI = srcROI.transform(transform);

        // Retrieve the destination bounds.
        Rectangle dstBounds = op.getBounds();

        // If necessary, clip the rotated ROI to the destination bounds.
        if(!dstBounds.contains(dstROI.getBounds())) {
            dstROI = dstROI.intersect(new ROIShape(dstBounds));
        }

        // Return the rotated and possibly clipped ROI.
        return dstROI;
    }

    return java.awt.Image.UndefinedProperty;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:78,代码来源:RotateDescriptor.java

示例5: getProperty

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
 * Returns the specified property.
 *
 * @param name  Property name.
 * @param opNode Operation node.
 */
public Object getProperty(String name,
                          Object opNode) {
    validate(name, opNode);

    if(opNode instanceof RenderedOp &&
       name.equalsIgnoreCase("roi")) {
        RenderedOp op = (RenderedOp)opNode;

        ParameterBlock pb = op.getParameterBlock();

        // Retrieve the rendered source image and its ROI.
        RenderedImage src = pb.getRenderedSource(0);
        Object property = src.getProperty("ROI");
        if (property == null ||
            property.equals(java.awt.Image.UndefinedProperty) ||
            !(property instanceof ROI)) {
            return java.awt.Image.UndefinedProperty;
        }
        ROI srcROI = (ROI)property;

        // Retrieve the Interpolation object.
        Interpolation interp = (Interpolation)pb.getObjectParameter(2);

        // Determine the effective source bounds.
        Rectangle srcBounds = null;
        PlanarImage dst = op.getRendering();
        if (dst instanceof GeometricOpImage &&
            ((GeometricOpImage)dst).getBorderExtender() == null) {
            srcBounds =
                new Rectangle(src.getMinX() + interp.getLeftPadding(),
                              src.getMinY() + interp.getTopPadding(),
                              src.getWidth() - interp.getWidth() + 1,
                              src.getHeight() - interp.getHeight() + 1);
        } else {
            srcBounds = new Rectangle(src.getMinX(),
	  src.getMinY(),
	  src.getWidth(),
	  src.getHeight());
        }

        // If necessary, clip the ROI to the effective source bounds.
        if(!srcBounds.contains(srcROI.getBounds())) {
            srcROI = srcROI.intersect(new ROIShape(srcBounds));
        }

        // Retrieve the translation values.
        float tx = pb.getFloatParameter(0);
        float ty = pb.getFloatParameter(1);

        // Create a transform representing the translation.
        AffineTransform transform =
            AffineTransform.getTranslateInstance((double) tx,
                                                 (double) ty);
        // Create the translated ROI.
        ROI dstROI = srcROI.transform(transform);

        // Retrieve the destination bounds.
        Rectangle dstBounds = op.getBounds();

        // If necessary, clip the warped ROI to the destination bounds.
        if(!dstBounds.contains(dstROI.getBounds())) {
            dstROI = dstROI.intersect(new ROIShape(dstBounds));
        }

        // Return the warped and possibly clipped ROI.
        return dstROI;
    }

    return java.awt.Image.UndefinedProperty;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:77,代码来源:TranslateDescriptor.java

示例6: getProperty

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
 * Returns the specified property.
 *
 * @param name  Property name.
 * @param opNode Operation node.
 */
public Object getProperty(String name,
                          Object opNode) {
    validate(name, opNode);

    if(opNode instanceof RenderedOp &&
       name.equalsIgnoreCase("roi")) {
        RenderedOp op = (RenderedOp)opNode;

        ParameterBlock pb = op.getParameterBlock();

        // Retrieve the rendered source image and its ROI.
        RenderedImage src = pb.getRenderedSource(0);
        Object property = src.getProperty("ROI");
        if (property == null ||
            property.equals(java.awt.Image.UndefinedProperty) ||
            !(property instanceof ROI)) {
            return java.awt.Image.UndefinedProperty;
        }
        ROI srcROI = (ROI)property;

        // Retrieve the Interpolation object.
        Interpolation interp = (Interpolation)pb.getObjectParameter(4);

        // Determine the effective source bounds.
        Rectangle srcBounds = null;
        PlanarImage dst = op.getRendering();
        if (dst instanceof GeometricOpImage &&
            ((GeometricOpImage)dst).getBorderExtender() == null) {
            srcBounds =
                new Rectangle(src.getMinX() + interp.getLeftPadding(),
                              src.getMinY() + interp.getTopPadding(),
                              src.getWidth() - interp.getWidth() + 1,
                              src.getHeight() - interp.getHeight() + 1);
        } else {
            srcBounds = new Rectangle(src.getMinX(),
	  src.getMinY(),
	  src.getWidth(),
	  src.getHeight());
        }

        // If necessary, clip the ROI to the effective source bounds.
        if(!srcBounds.contains(srcROI.getBounds())) {
            srcROI = srcROI.intersect(new ROIShape(srcBounds));
        }

        // Retrieve the scale factors and translation values.
        float sx = pb.getFloatParameter(0);
        float sy = pb.getFloatParameter(1);
        float tx = pb.getFloatParameter(2);
        float ty = pb.getFloatParameter(3);

        // Create an equivalent transform.
        AffineTransform transform =
            new AffineTransform(sx, 0.0, 0.0, sy, tx, ty);

        // Create the scaled ROI.
        ROI dstROI = srcROI.transform(transform);

        // Retrieve the destination bounds.
        Rectangle dstBounds = op.getBounds();

        // If necessary, clip the warped ROI to the destination bounds.
        if(!dstBounds.contains(dstROI.getBounds())) {
            dstROI = dstROI.intersect(new ROIShape(dstBounds));
        }

        // Return the warped and possibly clipped ROI.
        return dstROI;
    }

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

示例7: getProperty

import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
 * Returns the specified property.
 *
 * @param name Property name.
 * @param op   Operation node.
 */
public Object getProperty(String name,
                          RenderedOp op) {
    if(name == null || op == null) {
        throw new IllegalArgumentException
            (JaiI18N.getString("SubsampleAveragePropertyGenerator4"));
    }

    if (name.equals("roi")) {
        ParameterBlock pb = op.getParameterBlock();

        // Retrieve the rendered source image and its ROI.
        PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
        Object property = src.getProperty("ROI");
        if (property == null ||
            property.equals(java.awt.Image.UndefinedProperty) ||
            !(property instanceof ROI)) {
            return null;
        }
        ROI srcROI = (ROI)property;

        // Determine the effective source bounds.
        Rectangle srcBounds = null;
        PlanarImage dst = op.getRendering();
        if(dst instanceof GeometricOpImage &&
           ((GeometricOpImage)dst).getBorderExtender() == null) {
            GeometricOpImage geomIm = (GeometricOpImage)dst;
            Interpolation interp = geomIm.getInterpolation();
            srcBounds =
                new Rectangle(src.getMinX() + interp.getLeftPadding(),
                              src.getMinY() + interp.getTopPadding(),
                              src.getWidth() - interp.getWidth() + 1,
                              src.getHeight() - interp.getHeight() + 1);
        } else {
            srcBounds = src.getBounds();
        }

        // If necessary, clip the ROI to the effective source bounds.
        if(!srcBounds.contains(srcROI.getBounds())) {
            srcROI = srcROI.intersect(new ROIShape(srcBounds));
        }

        // Retrieve the scale factors and translation values.
        double sx = pb.getDoubleParameter(0);
        double sy = pb.getDoubleParameter(1);

        // Create an equivalent transform.
        AffineTransform transform =
            new AffineTransform(sx, 0.0, 0.0, sy, 0, 0);

        // Create the scaled ROI.
        ROI dstROI = srcROI.transform(transform);

        // Retrieve the destination bounds.
        Rectangle dstBounds = op.getBounds();

        // If necessary, clip the warped ROI to the destination bounds.
        if(!dstBounds.contains(dstROI.getBounds())) {
            dstROI = dstROI.intersect(new ROIShape(dstBounds));
        }

        // Return the warped and possibly clipped ROI.
        return dstROI;
    } else {
        return null;
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:73,代码来源:SubsampleAverageDescriptor.java


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