本文整理匯總了Java中com.caverock.androidsvg.SVG.Colour類的典型用法代碼示例。如果您正苦於以下問題:Java Colour類的具體用法?Java Colour怎麽用?Java Colour使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Colour類屬於com.caverock.androidsvg.SVG包,在下文中一共展示了Colour類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setPaintColour
import com.caverock.androidsvg.SVG.Colour; //導入依賴的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);
}
示例2: setPaintColour
import com.caverock.androidsvg.SVG.Colour; //導入依賴的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: setPaintColour
import com.caverock.androidsvg.SVG.Colour; //導入依賴的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);
}
示例4: parseColourKeyword
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private static Colour parseColourKeyword(String name) throws SAXException {
Integer col = ColourKeywords.get(name.toLowerCase(Locale.US));
if (col == null) {
throw new SAXException("Invalid colour keyword: " + name);
}
return new Colour(col.intValue());
}
示例5: viewportFill
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private void viewportFill() {
int col;
if (state.style.viewportFill instanceof SVG.Colour) {
col = ((SVG.Colour) state.style.viewportFill).colour;
} else if (state.style.viewportFill instanceof CurrentColor) {
col = state.style.color.colour;
} else {
return;
}
if (state.style.viewportFillOpacity != null)
col = clamp255(state.style.viewportFillOpacity) << 24 | col;
canvas.drawColor(col);
}
示例6: parseColourKeyword
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private static Colour parseColourKeyword(String name) throws SAXException {
Integer col = ColourKeywords.get(name.toLowerCase(Locale.US));
if (col == null) {
throw new SAXException("Invalid colour keyword: " + name);
}
return new Colour(col.intValue());
}
示例7: viewportFill
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private void viewportFill() {
int col;
if (state.style.viewportFill instanceof SVG.Colour) {
col = ((SVG.Colour) state.style.viewportFill).colour;
} else if (state.style.viewportFill instanceof CurrentColor) {
col = state.style.color.colour;
} else {
return;
}
if (state.style.viewportFillOpacity != null)
col = clamp255(state.style.viewportFillOpacity) << 24 | col;
canvas.drawColor(col);
}
示例8: parseColourKeyword
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private static Colour parseColourKeyword(String nameLowerCase) throws SVGParseException
{
Integer col = ColourKeywords.get(nameLowerCase);
if (col == null) {
throw new SVGParseException("Invalid colour keyword: "+nameLowerCase);
}
return new Colour(col);
}
示例9: viewportFill
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private void viewportFill()
{
int col;
if (state.style.viewportFill instanceof SVG.Colour) {
col = ((SVG.Colour) state.style.viewportFill).colour;
} else if (state.style.viewportFill instanceof CurrentColor) {
col = state.style.color.colour;
} else {
return;
}
if (state.style.viewportFillOpacity != null)
col = colourWithOpacity(col, state.style.viewportFillOpacity);
canvas.drawColor(col);
}
示例10: parseColour
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private static Colour parseColour(String val) throws SAXException {
if (val.charAt(0) == '#') {
IntegerParser ip = IntegerParser.parseHex(val, 1, val.length());
if (ip == null) {
throw new SAXException("Bad hex colour value: " + val);
}
int pos = ip.getEndPos();
if (pos == 7) {
return new Colour(ip.value());
} else if (pos == 4) {
int threehex = ip.value();
int h1 = threehex & 0xf00;
int h2 = threehex & 0x0f0;
int h3 = threehex & 0x00f;
return new Colour(h1 << 12 | h1 << 8 | h2 << 8 | h2 << 4
| h3 << 4 | h3);
}
// Hex value had bad length for a colour
throw new SAXException("Bad hex colour value: " + val);
}
if (val.toLowerCase(Locale.US).startsWith("rgb(")) {
TextScanner scan = new TextScanner(val.substring(4));
scan.skipWhitespace();
float red = scan.nextFloat();
if (!Float.isNaN(red) && scan.consume('%'))
red = (red * 256) / 100;
float green = scan.checkedNextFloat(red);
if (!Float.isNaN(green) && scan.consume('%'))
green = (green * 256) / 100;
float blue = scan.checkedNextFloat(green);
if (!Float.isNaN(blue) && scan.consume('%'))
blue = (blue * 256) / 100;
scan.skipWhitespace();
if (Float.isNaN(blue) || !scan.consume(')'))
throw new SAXException("Bad rgb() colour value: " + val);
return new Colour(clamp255(red) << 16 | clamp255(green) << 8
| clamp255(blue));
}
// Must be a colour keyword
else
return parseColourKeyword(val);
}
示例11: parseColour
import com.caverock.androidsvg.SVG.Colour; //導入依賴的package包/類
private static Colour parseColour(String val) throws SAXException {
if (val.charAt(0) == '#') {
IntegerParser ip = IntegerParser.parseHex(val, 1, val.length());
if (ip == null) {
throw new SAXException("Bad hex colour value: " + val);
}
int pos = ip.getEndPos();
if (pos == 7) {
return new Colour(ip.value());
} else if (pos == 4) {
int threehex = ip.value();
int h1 = threehex & 0xf00;
int h2 = threehex & 0x0f0;
int h3 = threehex & 0x00f;
return new Colour(h1 << 12 | h1 << 8 | h2 << 8 | h2 << 4 | h3 << 4 | h3);
}
// Hex value had bad length for a colour
throw new SAXException("Bad hex colour value: " + val);
}
if (val.toLowerCase(Locale.US).startsWith("rgb(")) {
TextScanner scan = new TextScanner(val.substring(4));
scan.skipWhitespace();
float red = scan.nextFloat();
if (!Float.isNaN(red) && scan.consume('%'))
red = (red * 256) / 100;
float green = scan.checkedNextFloat(red);
if (!Float.isNaN(green) && scan.consume('%'))
green = (green * 256) / 100;
float blue = scan.checkedNextFloat(green);
if (!Float.isNaN(blue) && scan.consume('%'))
blue = (blue * 256) / 100;
scan.skipWhitespace();
if (Float.isNaN(blue) || !scan.consume(')'))
throw new SAXException("Bad rgb() colour value: " + val);
return new Colour(clamp255(red) << 16 | clamp255(green) << 8 | clamp255(blue));
}
// Must be a colour keyword
else
return parseColourKeyword(val);
}