本文整理匯總了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});
}
示例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;
}
示例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();
}