コード例 #1
0
  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);
      }
    }
  }
コード例 #2
0
  public void setFillColor(String value) {
    if (state.fillColorValue == null || !state.fillColorValue.equals(value)) {
      state.fillColorValue = value;
      state.fillColor = null;

      // Setting fill color resets gradient paint
      state.gradientPaint = null;
    }
  }