當前位置: 首頁>>代碼示例>>Java>>正文


Java ConvolveOp.getEdgeCondition方法代碼示例

本文整理匯總了Java中java.awt.image.ConvolveOp.getEdgeCondition方法的典型用法代碼示例。如果您正苦於以下問題:Java ConvolveOp.getEdgeCondition方法的具體用法?Java ConvolveOp.getEdgeCondition怎麽用?Java ConvolveOp.getEdgeCondition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.image.ConvolveOp的用法示例。


在下文中一共展示了ConvolveOp.getEdgeCondition方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: enableConvolveOp

import java.awt.image.ConvolveOp; //導入方法依賴的package包/類
private static void enableConvolveOp(RenderQueue rq,
                                     SurfaceData srcData,
                                     ConvolveOp cop)
{
    // assert rq.lock.isHeldByCurrentThread();
    boolean edgeZero =
        cop.getEdgeCondition() == ConvolveOp.EDGE_ZERO_FILL;
    Kernel kernel = cop.getKernel();
    int kernelWidth = kernel.getWidth();
    int kernelHeight = kernel.getHeight();
    int kernelSize = kernelWidth * kernelHeight;
    int sizeofFloat = 4;
    int totalBytesRequired = 4 + 8 + 12 + (kernelSize * sizeofFloat);

    RenderBuffer buf = rq.getBuffer();
    rq.ensureCapacityAndAlignment(totalBytesRequired, 4);
    buf.putInt(ENABLE_CONVOLVE_OP);
    buf.putLong(srcData.getNativeOps());
    buf.putInt(edgeZero ? 1 : 0);
    buf.putInt(kernelWidth);
    buf.putInt(kernelHeight);
    buf.put(kernel.getKernelData(null));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:BufferedBufImgOps.java

示例2: toSVG

import java.awt.image.ConvolveOp; //導入方法依賴的package包/類
/**
 * @param convolveOp the ConvolveOp to be converted
 * @return a description of the SVG filter corresponding to
 *         convolveOp. The definition of the feConvolveMatrix
 *         filter in put in feConvolveMatrixDefSet
 */
public SVGFilterDescriptor toSVG(ConvolveOp convolveOp){
    // Reuse definition if convolveOp has already been converted
    SVGFilterDescriptor filterDesc =
        (SVGFilterDescriptor)descMap.get(convolveOp);
    Document domFactory = generatorContext.domFactory;

    if (filterDesc == null) {
        //
        // First time filter is converted: create its corresponding
        // SVG filter
        //
        Kernel kernel = convolveOp.getKernel();
        Element filterDef =
            domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FILTER_TAG);
        Element feConvolveMatrixDef =
            domFactory.createElementNS(SVG_NAMESPACE_URI,
                                       SVG_FE_CONVOLVE_MATRIX_TAG);

        // Convert the kernel size
        feConvolveMatrixDef.setAttributeNS(null, SVG_ORDER_ATTRIBUTE,
                                         kernel.getWidth() + SPACE +
                                         kernel.getHeight());

        // Convert the kernel values
        float[] data = kernel.getKernelData(null);
        StringBuffer kernelMatrixBuf = new StringBuffer( data.length * 8 );
        for(int i=0; i<data.length; i++){
            kernelMatrixBuf.append(doubleString(data[i]));
            kernelMatrixBuf.append(SPACE);
        }

        feConvolveMatrixDef.
            setAttributeNS(null, SVG_KERNEL_MATRIX_ATTRIBUTE,
                           kernelMatrixBuf.toString().trim());

        filterDef.appendChild(feConvolveMatrixDef);

        filterDef.setAttributeNS(null, SVG_ID_ATTRIBUTE,
                                 generatorContext.idGenerator.
                                 generateID(ID_PREFIX_FE_CONVOLVE_MATRIX));

        // Convert the edge mode
        if(convolveOp.getEdgeCondition() == ConvolveOp.EDGE_NO_OP)
            feConvolveMatrixDef.setAttributeNS(null, SVG_EDGE_MODE_ATTRIBUTE,
                                             SVG_DUPLICATE_VALUE);
        else
            feConvolveMatrixDef.setAttributeNS(null, SVG_EDGE_MODE_ATTRIBUTE,
                                             SVG_NONE_VALUE);

        //
        // Create a filter descriptor
        //

        // Process filter attribute
        StringBuffer filterAttrBuf = new StringBuffer(URL_PREFIX);
        filterAttrBuf.append(SIGN_POUND);
        filterAttrBuf.append(filterDef.getAttributeNS(null, SVG_ID_ATTRIBUTE));
        filterAttrBuf.append(URL_SUFFIX);

        filterDesc = new SVGFilterDescriptor(filterAttrBuf.toString(),
                                             filterDef);

        defSet.add(filterDef);
        descMap.put(convolveOp, filterDesc);
    }

    return filterDesc;
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:75,代碼來源:SVGConvolveOp.java


注:本文中的java.awt.image.ConvolveOp.getEdgeCondition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。