public UPath rotate(double theta) { final UPath result = new UPath(); for (USegment seg : segments) { result.addInternal(seg.rotate(theta)); } return result; }
public UPath translate(double dx, double dy) { final UPath result = new UPath(); for (USegment seg : segments) { result.addInternal(seg.translate(dx, dy)); } return result; }
private UPath getSpecificFrontierForCloud(double width, double height) { final UPath path = new UPath(); path.moveTo(0, 10); double x = 0; for (int i = 0; i < width - 9; i += 10) { path.cubicTo(0 + i, -3 + 10, 2 + i, -5 + 10, 5 + i, -5 + 10); path.cubicTo(8 + i, -5 + 10, 10 + i, -3 + 10, 10 + i, 0 + 10); x = i + 10; } double y = 0; for (int j = 10; j < height - 9; j += 10) { path.cubicTo(x + 3, 0 + j, x + 5, 2 + j, x + 5, 5 + j); path.cubicTo(x + 5, 8 + j, x + 3, 10 + j, x, 10 + j); y = j + 10; } for (int i = 0; i < width - 9; i += 10) { path.cubicTo(x - i, y + 3, x - 3 - i, y + 5, x - 5 - i, y + 5); path.cubicTo(x - 8 - i, y + 5, x - 10 - i, y + 3, x - 10 - i, y); } for (int j = 0; j < height - 9 - 10; j += 10) { path.cubicTo(-3, y - j, -5, y - 2 - j, -5, y - 5 - j); path.cubicTo(-5, y - 8 - j, -3, y - 10 - j, 0, y - 10 - j); } return path; }
private void drawCloud( UGraphic ug, double xTheoricalPosition, double yTheoricalPosition, double width, double height, boolean shadowing) { final UPath shape = getSpecificFrontierForCloud(width, height); if (shadowing) { shape.setDeltaShadow(3.0); } ug.draw(xTheoricalPosition + 3, yTheoricalPosition - 3, shape); }
public UPath getUPath(FontRenderContext frc) { final UPath result = new UPath(); final PathIterator path = getPathIteratorCharacter(frc); final double coord[] = new double[6]; while (path.isDone() == false) { final int code = path.currentSegment(coord); result.add(coord, USegmentType.getByCode(code)); path.next(); } return result; }
public UPath toUPath() { final UPath result = new UPath(); boolean start = true; for (CubicCurve2D.Double bez : beziers) { if (start) { result.add(new double[] {bez.x1, bez.y1}, USegmentType.SEG_MOVETO); start = false; } result.add( new double[] {bez.ctrlx1, bez.ctrly1, bez.ctrlx2, bez.ctrly2, bez.x2, bez.y2}, USegmentType.SEG_CUBICTO); } return result; }
public void draw( UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { final UPath shape = (UPath) ushape; final String color = param.getColor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param.getColor())); final String backcolor = param.getBackcolor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param.getBackcolor())); // // Shadow // if (shape.getDeltaShadow() != 0) { // double lastX = 0; // double lastY = 0; // for (USegment seg : shape) { // final USegmentType type = seg.getSegmentType(); // final double coord[] = seg.getCoord(); // if (type == USegmentType.SEG_MOVETO) { // lastX = x + coord[0]; // lastY = y + coord[1]; // } else if (type == USegmentType.SEG_LINETO) { // svg.svgLineShadow(lastX, lastY, x + coord[0], y + coord[1], shape.getDeltaShadow()); // lastX = x + coord[0]; // lastY = y + coord[1]; // } else { // throw new UnsupportedOperationException(); // } // } // } svg.setFillColor(backcolor); svg.setStrokeColor(color); svg.setStrokeWidth("" + param.getStroke().getThickness(), param.getStroke().getDasharraySvg()); svg.svgPath(x, y, shape, shape.getDeltaShadow()); }