forked from I2P_Developers/i2p.i2p
SVG: Optimize output of color alpha values
as suggested by drzed
This commit is contained in:
@ -349,19 +349,12 @@ public class SimpleSVGMaker {
|
|||||||
private void addStroke(String type, Color color, BasicStroke stroke) {
|
private void addStroke(String type, Color color, BasicStroke stroke) {
|
||||||
buf.append(type);
|
buf.append(type);
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
// todo getRGB() #tohex & 0xffffff
|
// Output RGB or RGBA. getRGB() is ARGB.
|
||||||
//buf.append("=\"rgb(").append(color.getRed())
|
buf.append("=\"#").append(String.format(Locale.US, "%06x", color.getRGB() & 0xffffff));
|
||||||
// .append(',').append(color.getGreen())
|
|
||||||
// .append(',').append(color.getBlue())
|
|
||||||
// .append(")\" ");
|
|
||||||
buf.append("=\"#").append(String.format(Locale.US, "%06x", color.getRGB() & 0xffffff))
|
|
||||||
.append("\" ");
|
|
||||||
int alpha = color.getAlpha();
|
int alpha = color.getAlpha();
|
||||||
if (alpha < 255) {
|
if (alpha < 255)
|
||||||
buf.append(type).append("-opacity=\"")
|
buf.append(String.format(Locale.US, "%02x", alpha));
|
||||||
.append(String.format(Locale.US, "%.2f", alpha / 255f))
|
buf.append("\" ");
|
||||||
.append("\" ");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// default is black opaque, so fixup for none
|
// default is black opaque, so fixup for none
|
||||||
buf.append("=\"none\" ");
|
buf.append("=\"none\" ");
|
||||||
|
Reference in New Issue
Block a user