本文整理匯總了Java中org.apache.batik.ext.awt.MultipleGradientPaint.ColorSpaceEnum方法的典型用法代碼示例。如果您正苦於以下問題:Java MultipleGradientPaint.ColorSpaceEnum方法的具體用法?Java MultipleGradientPaint.ColorSpaceEnum怎麽用?Java MultipleGradientPaint.ColorSpaceEnum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.batik.ext.awt.MultipleGradientPaint
的用法示例。
在下文中一共展示了MultipleGradientPaint.ColorSpaceEnum方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convertColorInterpolation
import org.apache.batik.ext.awt.MultipleGradientPaint; //導入方法依賴的package包/類
/**
* Returns the color space for the specified element. Checks the
* 'color-interpolation' property
*
* @param e the element
*/
public static MultipleGradientPaint.ColorSpaceEnum
convertColorInterpolation(Element e) {
Value v = getComputedStyle(e, SVGCSSEngine.COLOR_INTERPOLATION_INDEX);
return (CSS_LINEARRGB_VALUE == v.getStringValue())
? MultipleGradientPaint.LINEAR_RGB
: MultipleGradientPaint.SRGB;
}
示例2: createPaint
import org.apache.batik.ext.awt.MultipleGradientPaint; //導入方法依賴的package包/類
/**
* Creates a <code>Paint</code> according to the specified parameters.
*
* @param ctx the bridge context to use
* @param paintElement the element that defines a Paint
* @param paintedElement the element referencing the paint
* @param paintedNode the graphics node on which the Paint will be applied
* @param opacity the opacity of the Paint to create
*/
public Paint createPaint(BridgeContext ctx,
Element paintElement,
Element paintedElement,
GraphicsNode paintedNode,
float opacity) {
String s;
// stop elements
List stops = extractStop(paintElement, opacity, ctx);
// if no stops are defined, painting is the same as 'none'
if (stops == null) {
return null;
}
int stopLength = stops.size();
// if one stops is defined, painting is the same as a single color
if (stopLength == 1) {
return ((Stop)stops.get(0)).color;
}
float [] offsets = new float[stopLength];
Color [] colors = new Color[stopLength];
Iterator iter = stops.iterator();
for (int i=0; iter.hasNext(); ++i) {
Stop stop = (Stop)iter.next();
offsets[i] = stop.offset;
colors[i] = stop.color;
}
// 'spreadMethod' attribute - default is pad
MultipleGradientPaint.CycleMethodEnum spreadMethod
= MultipleGradientPaint.NO_CYCLE;
s = SVGUtilities.getChainableAttributeNS
(paintElement, null, SVG_SPREAD_METHOD_ATTRIBUTE, ctx);
if (s.length() != 0) {
spreadMethod = convertSpreadMethod(paintElement, s, ctx);
}
// 'color-interpolation' CSS property
MultipleGradientPaint.ColorSpaceEnum colorSpace
= CSSUtilities.convertColorInterpolation(paintElement);
// 'gradientTransform' attribute - default is an Identity matrix
AffineTransform transform;
s = SVGUtilities.getChainableAttributeNS
(paintElement, null, SVG_GRADIENT_TRANSFORM_ATTRIBUTE, ctx);
if (s.length() != 0) {
transform = SVGUtilities.convertTransform
(paintElement, SVG_GRADIENT_TRANSFORM_ATTRIBUTE, s, ctx);
} else {
transform = new AffineTransform();
}
Paint paint = buildGradient(paintElement,
paintedElement,
paintedNode,
spreadMethod,
colorSpace,
transform,
colors,
offsets,
ctx);
return paint;
}
示例3: buildGradient
import org.apache.batik.ext.awt.MultipleGradientPaint; //導入方法依賴的package包/類
/**
* Builds a concrete gradient according to the specified parameters.
*
* @param paintElement the element that defines a Paint
* @param paintedElement the element referencing the paint
* @param paintedNode the graphics node on which the Paint will be applied
* @param spreadMethod the spread method
* @param colorSpace the color space (sRGB | LinearRGB)
* @param transform the gradient transform
* @param colors the colors of the gradient
* @param offsets the offsets
* @param ctx the bridge context to use
*/
protected abstract
Paint buildGradient(Element paintElement,
Element paintedElement,
GraphicsNode paintedNode,
MultipleGradientPaint.CycleMethodEnum spreadMethod,
MultipleGradientPaint.ColorSpaceEnum colorSpace,
AffineTransform transform,
Color [] colors,
float [] offsets,
BridgeContext ctx);