Exemplo n.º 1
0
 /**
  * Gets the fill paint for the specified figure based on the attributes FILL_GRADIENT,
  * FILL_OPACITY, FILL_PAINT and the bounds of the figure. Returns null if the figure is not
  * filled.
  */
 public static Paint getFillPaint(Figure f) {
   double opacity = FILL_OPACITY.get(f);
   if (FILL_GRADIENT.get(f) != null) {
     return FILL_GRADIENT.get(f).getPaint(f, opacity);
   }
   Color color = FILL_COLOR.get(f);
   if (color != null) {
     if (opacity != 1) {
       color = new Color((color.getRGB() & 0xffffff) | (int) (opacity * 255) << 24, true);
     }
   }
   return color;
 }
Exemplo n.º 2
0
  /** Sets SVG default values. */
  public static void setDefaults(Figure f) {
    // Fill properties
    // http://www.w3.org/TR/SVGMobile12/painting.html#FillProperties
    FILL_COLOR.basicSet(f, Color.black);
    WINDING_RULE.basicSet(f, WindingRule.NON_ZERO);

    // Stroke properties
    // http://www.w3.org/TR/SVGMobile12/painting.html#StrokeProperties
    STROKE_COLOR.basicSet(f, null);
    STROKE_WIDTH.basicSet(f, 1d);
    STROKE_CAP.basicSet(f, BasicStroke.CAP_BUTT);
    STROKE_JOIN.basicSet(f, BasicStroke.JOIN_MITER);
    STROKE_MITER_LIMIT.basicSet(f, 4d);
    IS_STROKE_MITER_LIMIT_FACTOR.basicSet(f, false);
    STROKE_DASHES.basicSet(f, null);
    STROKE_DASH_PHASE.basicSet(f, 0d);
    IS_STROKE_DASH_FACTOR.basicSet(f, false);
  }
Exemplo n.º 3
0
 public Color getFillColor() {
   return FILL_COLOR.get(this) == null || FILL_COLOR.get(this).equals(Color.white)
       ? Color.black
       : Color.WHITE;
   //  return FILL_COLOR.get(this);
 }
Exemplo n.º 4
0
 public Color getTextColor() {
   return FILL_COLOR.get(this);
   //   return TEXT_COLOR.get(this);
 }