public static void renderPolygon(Graphics2D graphics, Polygon poly, Color color) { graphics.setColor(color); final Stroke originalStroke = graphics.getStroke(); graphics.setStroke(new BasicStroke(2)); graphics.drawPolygon(poly); graphics.setColor(new Color(0, 0, 0, 50)); graphics.fillPolygon(poly); graphics.setStroke(originalStroke); }
public void drawPolygon( int[] polygon ) { gc.drawPolygon( getSwingPolygon( polygon ) ); }
private void renderLocalPoint(Graphics2D graphics, LocalPoint local) { if (local != null) { Polygon canvasTilePoly = Perspective.getCanvasTilePoly(client, local); if (canvasTilePoly != null) { graphics.drawPolygon(canvasTilePoly); } } }
public void drawPolygon( int[] polygon ) { gc.drawPolygon( getSwingPolygon( polygon ) ); }
private void renderPlayerWireframe(Graphics2D graphics, Player player, Color color) { Polygon[] polys = player.getPolygons(); if (polys == null) { return; } graphics.setColor(color); for (Polygon p : polys) { graphics.drawPolygon(p); } }
g.setColor(Color.black); g.drawPolygon(xPoints, yPoints, 3);
g.setColor(Color.black); g.drawPolygon(xPoints, yPoints, 3);
g.setColor(Color.black); g.drawPolygon(xPoints, yPoints, 3);
g.setColor(Color.black); g.drawPolygon(xPoints, yPoints, 3);
protected void drawDot(Graphics2D g, int x, int y, int currentDotStyle) { switch (currentDotStyle) { case DOT_FULLCIRCLE: g.fillOval(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_FULLSQUARE: g.fillRect(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_FULLDIAMOND: g.fillPolygon(new int[] { x - dotSize / 2, x, x + dotSize / 2, x }, new int[] { y, y - dotSize / 2, y, y + dotSize / 2 }, 4); break; case DOT_EMPTYCIRCLE: g.drawOval(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_EMPTYSQUARE: g.drawRect(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_EMPTYDIAMOND: g.drawPolygon(new int[] { x - dotSize / 2, x, x + dotSize / 2, x }, new int[] { y, y - dotSize / 2, y, y + dotSize / 2 }, 4); break; default: break; } }
protected void drawDot(Graphics2D g, int x, int y, int currentDotStyle) { switch (currentDotStyle) { case DOT_FULLCIRCLE: g.fillOval(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_FULLSQUARE: g.fillRect(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_FULLDIAMOND: g.fillPolygon(new int[] { x - dotSize / 2, x, x + dotSize / 2, x }, new int[] { y, y - dotSize / 2, y, y + dotSize / 2 }, 4); break; case DOT_EMPTYCIRCLE: g.drawOval(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_EMPTYSQUARE: g.drawRect(x - dotSize / 2, y - dotSize / 2, dotSize, dotSize); break; case DOT_EMPTYDIAMOND: g.drawPolygon(new int[] { x - dotSize / 2, x, x + dotSize / 2, x }, new int[] { y, y - dotSize / 2, y, y + dotSize / 2 }, 4); break; default: break; } }
@Signature public void polygon(Environment env, ForeachIterator array, DrawOptions options) { List<Integer> xPoints = new ArrayList<>(); List<Integer> yPoints = new ArrayList<>(); while (array.next()) { Memory value = array.getValue(); Integer x = null, y = null; ForeachIterator sub = value.getNewIterator(env); while (sub.next()) { if (x == null) { y = x = sub.getValue().toInteger(); } else { y = sub.getValue().toInteger(); } } if (x != null && y != null) { xPoints.add(x); yPoints.add(y); } } int[] xs = xPoints.stream().mapToInt(i -> i).toArray(); int[] ys = yPoints.stream().mapToInt(i -> i).toArray(); applyOptions(options); if (options.isOutline()) { gc.drawPolygon(xs, ys, Math.min(xs.length, ys.length)); } else { gc.fillPolygon(xs, ys, Math.min(xs.length, ys.length)); } }
if (tile != null) graphics2D.drawPolygon(tile);
private void renderDecorObject(Graphics2D graphics, Tile tile, Player player) { DecorativeObject decorObject = tile.getDecorativeObject(); if (decorObject != null) { if (player.getLocalLocation().distanceTo(decorObject.getLocalLocation()) <= MAX_DISTANCE) { OverlayUtil.renderTileOverlay(graphics, decorObject, "ID: " + decorObject.getId(), DEEP_PURPLE); } Polygon p = decorObject.getConvexHull(); if (p != null) { graphics.drawPolygon(p); } } }
private void renderGameObjects(Graphics2D graphics, Tile tile, Player player) { GameObject[] gameObjects = tile.getGameObjects(); if (gameObjects != null) { for (GameObject gameObject : gameObjects) { if (gameObject != null) { if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= MAX_DISTANCE) { OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId(), GREEN); } // Draw a polygon around the convex hull // of the model vertices Polygon p = gameObject.getConvexHull(); if (p != null) { graphics.drawPolygon(p); } } } } }
graphics.drawPolygon(p); graphics.drawPolygon(p);
@Override public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) { groupG2D.drawPolygon(xPoints, yPoints, nPoints); alphaG2D.drawPolygon(xPoints, yPoints, nPoints); }
public void drawPolygon(Polygon p) { delegate.drawPolygon(p); }
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) { delegate.drawPolygon(xPoints, yPoints, nPoints); }
void fillPolygon(double[] x, double[] yBottom, double[] yTop, Paint paint) { gd.setPaint(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]; } gd.fillPolygon(xDev, yDev, xDev.length); gd.drawPolygon(xDev, yDev, xDev.length); } }