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


Java MultipleGradientPaint.REPEAT屬性代碼示例

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


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

示例1: if

/**
 * Converts the spreadMethod attribute.
 *
 * @param paintElement the paint Element with a spreadMethod
 * @param s the spread method
 * @param ctx the BridgeContext to use for error information
 */
protected static MultipleGradientPaint.CycleMethodEnum convertSpreadMethod
    (Element paintElement, String s, BridgeContext ctx) {
    if (SVG_REPEAT_VALUE.equals(s)) {
        return MultipleGradientPaint.REPEAT;
    }
    if (SVG_REFLECT_VALUE.equals(s)) {
        return MultipleGradientPaint.REFLECT;
    }
    if (SVG_PAD_VALUE.equals(s)) {
        return MultipleGradientPaint.NO_CYCLE;
    }
    throw new BridgeException
        (ctx, paintElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
         new Object[] {SVG_SPREAD_METHOD_ATTRIBUTE, s});
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:22,代碼來源:AbstractSVGGradientElementBridge.java

示例2: calculateGradient

private MultipleGradientPaint calculateGradient(final float[] fractions, final Color[] colors) {
    // set up the end points
    Point2D start = this.start;
    Point2D end = this.end;
    if(isReversed()) {
    //if(picker.reversedCheck.isSelected()) {
        start = this.end;
        end = this.start;
    }

    // set up the cycle type
    MultipleGradientPaint.CycleMethodEnum cycle = MultipleGradientPaint.NO_CYCLE;
    if(isRepeated()) {
    //if(picker.repeatedRadio.isSelected()) {
        cycle = MultipleGradientPaint.REPEAT;
    }
    if(isReflected()) {
    //if(picker.reflectedRadio.isSelected()) {
        cycle = MultipleGradientPaint.REFLECT;
    }
    
    // create the underlying gradient paint
    MultipleGradientPaint paint = null;
    if(isRadial()) { //picker.styleCombo.getSelectedItem().toString().equals("Radial")) {
        paint = new org.apache.batik.ext.awt.RadialGradientPaint(
        start, (float)start.distance(end),start,
        fractions, colors, cycle, MultipleGradientPaint.SRGB
        );
    } else {
        paint = new org.apache.batik.ext.awt.LinearGradientPaint(
        (float)start.getX(),
        (float)start.getY(),
        (float)end.getX(),
        (float)end.getY(),
        fractions,colors,cycle);            
    }
    return paint;
}
 
開發者ID:sing-group,項目名稱:aibench-project,代碼行數:38,代碼來源:GradientPreviewPanel.java

示例3: setGradient

/**
 * Sets the gradient within this panel to the new gradient. This will delete
 * the old gradient all of it's settings, resetting the slider, gradient
 * type selection, and other gradient configuration options to match the
 * new gradient.
 *
 * @param mgrad The desired gradient.
 */
public void setGradient(MultipleGradientPaint mgrad) {
    if(gradient == mgrad) {
        return;
    }
    float[] fracts = mgrad.getFractions();
    Color[] colors = mgrad.getColors();

    if(!thumbsMoving) {
        // update the slider properly
        if(slider.getModel().getThumbCount() !=
                mgrad.getColors().length) {
            // removing all thumbs;
            while(slider.getModel().getThumbCount() > 0) {
                slider.getModel().removeThumb(0);
            }
            // add them back
            for(int i=0; i<fracts.length; i++) {
                slider.getModel().addThumb(fracts[i],colors[i]);
            }
        } else {
            for(int i=0; i<fracts.length; i++) {
                slider.getModel().getThumbAt(i).setObject(colors[i]);
                slider.getModel().getThumbAt(i).setPosition(fracts[i]);
            }
        }
    } else {
        log.fine("not updating because it's moving");
    }
    if(mgrad instanceof RadialGradientPaint) {
        if(styleCombo.getSelectedItem() != GradientStyle.Radial) {
            styleCombo.setSelectedItem(GradientStyle.Radial);
        }
    } else {
        if(styleCombo.getSelectedItem() != GradientStyle.Linear) {
            styleCombo.setSelectedItem(GradientStyle.Linear);
        }
    }
    
    if(mgrad.getCycleMethod() == MultipleGradientPaint.REFLECT) {
        this.reflectedRadio.setSelected(true);
        gradientPreview.setReflected(true);
    }
    if(mgrad.getCycleMethod() == MultipleGradientPaint.REPEAT) {
        this.repeatedRadio.setSelected(true);
        gradientPreview.setRepeated(true);
    }
    gradientPreview.setGradient(mgrad);
    //reflectedRadio.setSelected()
    MultipleGradientPaint old = this.getGradient();
    gradient = mgrad;
    firePropertyChange("gradient",old,getGradient());
    repaint();
}
 
開發者ID:sing-group,項目名稱:aibench-project,代碼行數:61,代碼來源:JXGradientChooser.java


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