Пример #1
0
 public void drawOk(EpsGraphics eps, double x, double y) {
   boolean first = true;
   for (CubicCurve2D.Double bez : beziers) {
     bez =
         new CubicCurve2D.Double(
             x + bez.x1,
             y + bez.y1,
             x + bez.ctrlx1,
             y + bez.ctrly1,
             x + bez.ctrlx2,
             y + bez.ctrly2,
             x + bez.x2,
             y + bez.y2);
     eps.epsLine(bez.x1, bez.y1, bez.x2, bez.y2);
   }
 }
Пример #2
0
  public void draw(
      UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {

    final UClip clip = clipContainer.getClip();
    if (clip != null && clip.isInside(x, y) == false) {
      return;
    }

    final UText shape = (UText) ushape;

    if (strategy == EpsStrategy.WITH_MACRO_AND_TEXT) {
      drawAsText(shape, x, y, param, eps, mapper);
      return;
    }

    final FontConfiguration fontConfiguration = shape.getFontConfiguration();
    final UFont font = fontConfiguration.getFont();

    final TextLayout t = new TextLayout(shape.getText(), font.getFont(), fontRenderContext);
    eps.setStrokeColor(mapper.getMappedColor(fontConfiguration.getColor()));
    drawPathIterator(eps, x, y, t.getOutline(null).getPathIterator(null));

    if (fontConfiguration.containsStyle(FontStyle.UNDERLINE)) {
      final HtmlColor extended = fontConfiguration.getExtendedColor();
      if (extended != null) {
        eps.setStrokeColor(mapper.getMappedColor(extended));
      }
      final Dimension2D dim =
          DriverTextG2d.calculateDimension(stringBounder, font, shape.getText());
      eps.setStrokeWidth("1.1", 0, 0);
      eps.epsLine(x, y + 1.5, x + dim.getWidth(), y + 1.5);
      eps.setStrokeWidth("1", 0, 0);
    }
    if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
      final Dimension2D dim =
          DriverTextG2d.calculateDimension(stringBounder, font, shape.getText());
      final int ypos = (int) (y + 2.5) - 1;
      final HtmlColor extended = fontConfiguration.getExtendedColor();
      if (extended != null) {
        eps.setStrokeColor(mapper.getMappedColor(extended));
      }
      eps.setStrokeWidth("1.1", 0, 0);
      for (int i = (int) x; i < x + dim.getWidth() - 5; i += 6) {
        eps.epsLine(i, ypos - 0, i + 3, ypos + 1);
        eps.epsLine(i + 3, ypos + 1, i + 6, ypos - 0);
      }
      eps.setStrokeWidth("1", 0, 0);
    }
    if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
      final HtmlColor extended = fontConfiguration.getExtendedColor();
      if (extended != null) {
        eps.setStrokeColor(mapper.getMappedColor(extended));
      }
      final Dimension2D dim =
          DriverTextG2d.calculateDimension(stringBounder, font, shape.getText());
      final FontMetrics fm = g2dummy.getFontMetrics(font.getFont());
      final int ypos = (int) (y - fm.getDescent() - 0.5);
      eps.setStrokeWidth("1.3", 0, 0);
      eps.epsLine(x, ypos, x + dim.getWidth(), ypos);
      eps.setStrokeWidth("1", 0, 0);
    }
  }