/** * Sets the start point of the subpath. * @param x * @param y */ public void setStartPoint(float x, float y) { this.startPoint = new Point(x, y); }
@SuppressWarnings("CloneDoesntCallSuperClone") @Override public Object clone() { return new Point(x, y); } }
/** * Constructs a new subpath starting at the given point. */ public Subpath(float startPointX, float startPointY) { this.startPoint = new Point(startPointX, startPointY); }
/** * Constructs a new line based on the given coordinates. * @param x1 x-coordinate of start point of this Line * @param y1 y-coordinate of start point of this Line * @param x2 x-coordinate of end point of this Line * @param y2 y-coordinate of end point of this Line */ public Line(float x1, float y1, float x2, float y2) { p1 = new Point(x1, y1); p2 = new Point(x2, y2); }
/** * Appends the starting point to the end of {@link PolylineSvgNodeRenderer#points} if it is not already there. */ private void connectPoints() { if (points.size() < 2) { return; } Point start = points.get(0); Point end = points.get(points.size() - 1); if (Double.compare(start.x, end.x) != 0 && Double.compare(start.y, end.y) != 0) { points.add(new Point(start.x, start.y)); } }
/** * Converts list of {@link Point.LongPoint} objects into list of * {@link com.itextpdf.kernel.geom.Point} objects. */ public static List<com.itextpdf.kernel.geom.Point> convertToFloatPoints(List<Point.LongPoint> points) { List<com.itextpdf.kernel.geom.Point> convertedPoints = new ArrayList<>(points.size()); for (Point.LongPoint point : points) { convertedPoints.add(new com.itextpdf.kernel.geom.Point( point.getX() / floatMultiplier, point.getY() / floatMultiplier )); } return convertedPoints; }
protected List<Point> rectangleToPointsList(Rectangle rect) { List<Point> points = new ArrayList<>(); points.addAll(Arrays.asList(new Point(rect.getLeft(), rect.getBottom()), new Point(rect.getRight(), rect.getBottom()), new Point(rect.getRight(), rect.getTop()), new Point(rect.getLeft(), rect.getTop()))); return points; }
protected List<Point> rectangleToPointsList(Rectangle rect) { List<Point> points = new ArrayList<>(); points.addAll(Arrays.asList(new Point(rect.getLeft(), rect.getBottom()), new Point(rect.getRight(), rect.getBottom()), new Point(rect.getRight(), rect.getTop()), new Point(rect.getLeft(), rect.getTop()))); return points; }
/** * Creates new MetaState */ public MetaState() { savedStates = new Stack<>(); MetaObjects = new ArrayList<>(); currentPoint = new Point(0, 0); currentPen = new MetaPen(); currentBrush = new MetaBrush(); currentFont = new MetaFont(); }
protected Point createPoint(String coordX, String coordY) { return new Point((float)CssUtils.parseFloat(coordX), (float)CssUtils.parseFloat(coordY)); }
/** * Appends a straight line segment from the current point to the point <CODE>(x, y)</CODE>. * @param x x-coordinate of the new point * @param y y-coordinate of the new point */ public void lineTo(float x, float y) { if (currentPoint == null) { throw new RuntimeException(START_PATH_ERR_MSG); } Point targetPoint = new Point(x, y); getLastSubpath().addSegment(new Line(currentPoint, targetPoint)); currentPoint = targetPoint; }
public Point transform(Point src, Point dst) { if (dst == null) { dst = new Point(); } double x = src.getX(); double y = src.getY(); dst.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12); return dst; }
public Point deltaTransform(Point src, Point dst) { if (dst == null) { dst = new Point(); } double x = src.getX(); double y = src.getY(); dst.setLocation(x * m00 + y * m01, x * m10 + y * m11); return dst; }
public void transform(Point[] src, int srcOff, Point[] dst, int dstOff, int length) { while (--length >= 0) { Point srcPoint = src[srcOff++]; double x = srcPoint.getX(); double y = srcPoint.getY(); Point dstPoint = dst[dstOff]; if (dstPoint == null) { dstPoint = new Point(); } dstPoint.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12); dst[dstOff++] = dstPoint; } }
@Override public void doDraw(SvgDrawContext context) { PdfCanvas canvas = context.getCurrentCanvas(); canvas.writeLiteral("% path\n"); currentPoint = new Point(0, 0); for (IPathShape item : getShapes()) { item.draw(canvas); } }
public Point inverseTransform(Point src, Point dst) throws NoninvertibleTransformException { double det = getDeterminant(); if (Math.abs(det) < ZERO) { // awt.204=Determinant is zero throw new NoninvertibleTransformException("Determinant is zero. Cannot invert transformation"); //$NON-NLS-1$ } if (dst == null) { dst = new Point(); } double x = src.getX() - m02; double y = src.getY() - m12; dst.setLocation((x * m11 - y * m01) / det, (y * m00 - x * m10) / det); return dst; }
protected Point getIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd) { double A1 = lineBeg.getY() - lineEnd.getY(), A2 = clipLineBeg.getY() - clipLineEnd.getY(); double B1 = lineEnd.getX() - lineBeg.getX(), B2 = clipLineEnd.getX() - clipLineBeg.getX(); double C1 = lineBeg.getX() * lineEnd.getY() - lineBeg.getY() * lineEnd.getX(); double C2 = clipLineBeg.getX() * clipLineEnd.getY() - clipLineBeg.getY() * clipLineEnd.getX(); double M = B1 * A2 - B2 * A1; return new Point((B2 * C1 - B1 * C2) / M, (C2 * A1 - C1 * A2) / M); } }
private Point getIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd) { double A1 = lineBeg.getY() - lineEnd.getY(), A2 = clipLineBeg.getY() - clipLineEnd.getY(); double B1 = lineEnd.getX() - lineBeg.getX(), B2 = clipLineEnd.getX() - clipLineBeg.getX(); double C1 = lineBeg.getX() * lineEnd.getY() - lineBeg.getY() * lineEnd.getX(); double C2 = clipLineBeg.getX() * clipLineEnd.getY() - clipLineBeg.getY() * clipLineEnd.getX(); double M = B1 * A2 - B2 * A1; return new Point((B2 * C1 - B1 * C2) / M, (C2 * A1 - C1 * A2) / M); } }
protected Point getIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd) { double A1 = lineBeg.getY() - lineEnd.getY(), A2 = clipLineBeg.getY() - clipLineEnd.getY(); double B1 = lineEnd.getX() - lineBeg.getX(), B2 = clipLineEnd.getX() - clipLineBeg.getX(); double C1 = lineBeg.getX() * lineEnd.getY() - lineBeg.getY() * lineEnd.getX(); double C2 = clipLineBeg.getX() * clipLineEnd.getY() - clipLineBeg.getY() * clipLineEnd.getX(); double M = B1 * A2 - B2 * A1; return new Point((B2 * C1 - B1 * C2) / M, (C2 * A1 - C1 * A2) / M); } }
private Point getIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd) { double A1 = lineBeg.getY() - lineEnd.getY(), A2 = clipLineBeg.getY() - clipLineEnd.getY(); double B1 = lineEnd.getX() - lineBeg.getX(), B2 = clipLineEnd.getX() - clipLineBeg.getX(); double C1 = lineBeg.getX() * lineEnd.getY() - lineBeg.getY() * lineEnd.getX(); double C2 = clipLineBeg.getX() * clipLineEnd.getY() - clipLineBeg.getY() * clipLineEnd.getX(); double M = B1 * A2 - B2 * A1; return new Point((B2 * C1 - B1 * C2) / M, (C2 * A1 - C1 * A2) / M); } }