Beispiel #1
0
	internal void drawPolyline(double[] x, double[] y, Pen paint)
	{
		PathIterator path = new PathIterator(y);
		for (int[] pos = path.getNextPath(); pos != null; pos = path.getNextPath()) {
			int start = pos[0], end = pos[1];
			int[] xDev = new int[end - start], yDev = new int[end - start];
			for (int i = start; i < end; i++) {
				xDev[i - start] = (int) x[i];
				yDev[i - start] = (int) y[i];
			}
			drawPolyline(xDev, yDev,paint);
		}
	}
Beispiel #2
0
	internal void fillPolygon(double[] x, double yBottom, double[] yTop, Brush paint)
	{
		PathIterator path = new PathIterator(yTop);
		for (int[] pos = path.getNextPath(); pos != null; pos = path.getNextPath()) {
			int start = pos[0], end = pos[1], n = end - start;
			int[] xDev = new int[n + 2], yDev = new int[n + 2];
			for (int i = start; i < end; i++) {
				xDev[i - start] = (int) x[i];
				yDev[i - start] = (int) yTop[i];
			}
			xDev[n] = xDev[n - 1];
			xDev[n + 1] = xDev[0];
			yDev[n] = yDev[n + 1] = (int) yBottom;
			fillPolygon(xDev, yDev, paint);
			drawPolygon(xDev, yDev, new Pen(paint));
		}
	}
Beispiel #3
0
	internal void fillPolygon(double[] x, double[] yBottom, double[] yTop, Brush paint)
	{
		PathIterator path = new PathIterator(yTop);
		for (int[] pos = path.getNextPath(); pos != null; pos = path.getNextPath()) {
			int start = pos[0], end = pos[1], n = end - start;
			int[] xDev = new int[n * 2], yDev = new int[n * 2];
			for (int i = start; i < end; i++) {
				int ix1 = i - start, ix2 = n * 2 - 1 - i + start;
				xDev[ix1] = xDev[ix2] = (int) x[i];
				yDev[ix1] = (int) yTop[i];
				yDev[ix2] = (int) yBottom[i];
			}
			fillPolygon(xDev, yDev, paint);
			drawPolygon(xDev, yDev, new Pen(paint));
		}
	}