本文整理汇总了Java中com.caverock.androidsvg.SVG.SvgPaint类的典型用法代码示例。如果您正苦于以下问题:Java SvgPaint类的具体用法?Java SvgPaint怎么用?Java SvgPaint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SvgPaint类属于com.caverock.androidsvg.SVG包,在下文中一共展示了SvgPaint类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parsePaintSpecifier
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private static SvgPaint parsePaintSpecifier(String val, String attrName)
throws SAXException {
if (val.startsWith("url(")) {
int closeBracket = val.indexOf(")");
if (closeBracket == -1)
throw new SAXException("Bad " + attrName
+ " attribute. Unterminated url() reference");
String href = val.substring(4, closeBracket).trim();
SvgPaint fallback = null;
val = val.substring(closeBracket + 1).trim();
if (val.length() > 0)
fallback = parseColourSpecifer(val);
return new PaintReference(href, fallback);
}
return parseColourSpecifer(val);
}
示例2: setPaintColour
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private void setPaintColour(RendererState state, boolean isFill,
SvgPaint paint) {
float paintOpacity = (isFill) ? state.style.fillOpacity
: state.style.strokeOpacity;
int col;
if (paint instanceof SVG.Colour) {
col = ((SVG.Colour) paint).colour;
} else if (paint instanceof CurrentColor) {
col = state.style.color.colour;
} else {
return;
}
col = clamp255(paintOpacity) << 24 | col;
if (isFill)
state.fillPaint.setColor(col);
else
state.strokePaint.setColor(col);
}
示例3: parsePaintSpecifier
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private static SvgPaint parsePaintSpecifier(String val, String attrName) throws SAXException {
if (val.startsWith("url(")) {
int closeBracket = val.indexOf(")");
if (closeBracket == -1)
throw new SAXException("Bad " + attrName + " attribute. Unterminated url() reference");
String href = val.substring(4, closeBracket).trim();
SvgPaint fallback = null;
val = val.substring(closeBracket + 1).trim();
if (val.length() > 0)
fallback = parseColourSpecifer(val);
return new PaintReference(href, fallback);
}
return parseColourSpecifer(val);
}
示例4: setPaintColour
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private void setPaintColour(RendererState state, boolean isFill, SvgPaint paint) {
float paintOpacity = (isFill) ? state.style.fillOpacity : state.style.strokeOpacity;
int col;
if (paint instanceof SVG.Colour) {
col = ((SVG.Colour) paint).colour;
} else if (paint instanceof CurrentColor) {
col = state.style.color.colour;
} else {
return;
}
col = clamp255(paintOpacity) << 24 | col;
if (isFill)
state.fillPaint.setColor(col);
else
state.strokePaint.setColor(col);
}
示例5: parsePaintSpecifier
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private static SvgPaint parsePaintSpecifier(String val, String attrName) throws SVGParseException
{
if (val.startsWith("url("))
{
int closeBracket = val.indexOf(")");
if (closeBracket == -1)
throw new SVGParseException("Bad "+attrName+" attribute. Unterminated url() reference");
String href = val.substring(4, closeBracket).trim();
SvgPaint fallback = null;
val = val.substring(closeBracket+1).trim();
if (val.length() > 0)
fallback = parseColourSpecifer(val);
return new PaintReference(href, fallback);
}
return parseColourSpecifer(val);
}
示例6: setPaintColour
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private void setPaintColour(RendererState state, boolean isFill, SvgPaint paint)
{
float paintOpacity = (isFill) ? state.style.fillOpacity : state.style.strokeOpacity;
int col;
if (paint instanceof SVG.Colour) {
col = ((SVG.Colour) paint).colour;
} else if (paint instanceof CurrentColor) {
col = state.style.color.colour;
} else {
return;
}
col = colourWithOpacity(col, paintOpacity);
if (isFill)
state.fillPaint.setColor(col);
else
state.strokePaint.setColor(col);
}
示例7: parseColourSpecifer
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private static SvgPaint parseColourSpecifer(String val) throws SAXException {
if (val.equals(NONE)) {
return null;
} else if (val.equals(CURRENTCOLOR)) {
return CurrentColor.getInstance();
} else {
return parseColour(val);
}
}
示例8: parseColourSpecifer
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private static SvgPaint parseColourSpecifer(String val) throws SAXException {
if (val.equals(NONE)) {
return null;
} else if (val.equals(CURRENTCOLOR)) {
return CurrentColor.getInstance();
} else {
return parseColour(val);
}
}
示例9: parseColourSpecifer
import com.caverock.androidsvg.SVG.SvgPaint; //导入依赖的package包/类
private static SvgPaint parseColourSpecifer(String val) throws SVGParseException
{
switch (val) {
case NONE:
return null;
case CURRENTCOLOR:
return CurrentColor.getInstance();
default:
return parseColour(val);
}
}