/** Caches color conversion as it is expensive. */ public void setStrokeColor(String value) { // Lazy and cached instantiation strategy for all stroke properties if (state.strokeColorValue == null || !state.strokeColorValue.equals(value)) { state.strokeColorValue = value; state.strokeColor = null; } }
protected void paintCurrentPath(boolean filled, boolean stroked) { if (currentPath != null) { if (stroked) { if (state.strokeColor == null) { state.strokeColor = parseColor(state.strokeColorValue); } if (state.strokeColor != null) { updateStroke(); } } if (filled) { if (state.gradientPaint == null && state.fillColor == null) { state.fillColor = parseColor(state.fillColorValue); } } if (state.shadow) { paintShadow(filled, stroked); } if (filled) { if (state.gradientPaint != null) { state.g.setPaint(state.gradientPaint); state.g.fill(currentPath); } else { if (state.fillColor == null) { state.fillColor = parseColor(state.fillColorValue); } if (state.fillColor != null) { state.g.setColor(state.fillColor); state.g.setPaint(null); state.g.fill(currentPath); } } } if (stroked && state.strokeColor != null) { state.g.setColor(state.strokeColor); state.g.draw(currentPath); } } }