Refine search
private void renderSelectedChunk(Graphics2D g, int offsetx, int offsety, Vector3i pos) { if (pos != null) { g.setColor(COLOR_SELECTED_CHUNK); g.drawRect(pos.x * chunkSize + offsetx, pos.z * chunkSize + offsety, chunkSize - 1, chunkSize - 1); g.drawRect(pos.x * chunkSize + offsetx - 1, pos.z * chunkSize + offsety - 1, chunkSize + 1, chunkSize + 1); } }
protected void paintComponent (Graphics graphics) { Graphics2D g = (Graphics2D)graphics; int width = getWidth() - 1; int height = getHeight() - 1; for (int i = 0, n = paletteColors.length - 1; i < n; i++) { Color color1 = paletteColors[i]; Color color2 = paletteColors[i + 1]; float point1 = i / (float)n * width; float point2 = (i + 1) / (float)n * width; g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false)); g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height); } g.setPaint(null); g.setColor(Color.black); g.drawRect(0, 0, width, height); } }
protected void paintComponent (Graphics graphics) { Graphics2D g = (Graphics2D)graphics; int width = getWidth() - 1; int height = getHeight() - 1; for (int i = 0, n = paletteColors.length - 1; i < n; i++) { Color color1 = paletteColors[i]; Color color2 = paletteColors[i + 1]; float point1 = i / (float)n * width; float point2 = (i + 1) / (float)n * width; g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false)); g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height); } g.setPaint(null); g.setColor(Color.black); g.drawRect(0, 0, width, height); } }
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 paintComponent (Graphics graphics) { Graphics2D g = (Graphics2D)graphics; int width = getWidth() - 1; int height = getHeight() - 1; for (int i = 0, n = paletteColors.length - 1; i < n; i++) { Color color1 = paletteColors[i]; Color color2 = paletteColors[i + 1]; float point1 = i / (float)n * width; float point2 = (i + 1) / (float)n * width; g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false)); g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height); } g.setPaint(null); g.setColor(Color.black); g.drawRect(0, 0, width, height); } }
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 paintComponent (Graphics graphics) { Graphics2D g = (Graphics2D)graphics; int width = getWidth() - 1; int height = getHeight() - 1; for (int i = 0, n = paletteColors.length - 1; i < n; i++) { Color color1 = paletteColors[i]; Color color2 = paletteColors[i + 1]; float point1 = i / (float)n * width; float point2 = (i + 1) / (float)n * width; g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false)); g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height); } g.setPaint(null); g.setColor(Color.black); g.drawRect(0, 0, width, height); } }
@Path("discrete") @GET public Response discrete( @DefaultValue("2") @QueryParam("width") final int width, @DefaultValue("50") @QueryParam("upper") final int upper, @DefaultValue("red") @QueryParam("upper-color") final ColorParam upperColor, @DefaultValue("gray") @QueryParam("lower-color") final ColorParam lowerColor ) { final BufferedImage image = new BufferedImage( data.size() * width - 1, imageHeight, BufferedImage.TYPE_INT_RGB); final Graphics2D g = image.createGraphics(); g.setBackground(Color.WHITE); g.clearRect(0, 0, image.getWidth(), image.getHeight()); final int gap = 4; final float d = (limits.width() + 1) / (float) (imageHeight - gap); for (int i = 0, x = 0, y; i < data.size(); i++, x += width) { final int v = data.get(i); g.setColor((v >= upper) ? upperColor : lowerColor); y = imageHeight - (int) ((v - limits.lower()) / d); g.drawRect(x, y - gap, width - 2, gap); } return Response.ok(image).tag(tag).build(); }
private static void renderBar(Graphics2D graphics, int x, int y, int max, int current, int height, Color filled) { graphics.setColor(BACKGROUND); graphics.drawRect(x, y, WIDTH - PADDING, height - PADDING); graphics.fillRect(x, y, WIDTH, height); final int filledHeight = getBarHeight(max, current, height); graphics.setColor(filled); graphics.fillRect(x + PADDING, y + PADDING + (height - filledHeight), WIDTH - PADDING * OFFSET, filledHeight - PADDING * OFFSET); }
private void drawMapIcons(BufferedImage image, int drawBaseX, int drawBaseY, Region region, int z) { int baseX = region.getBaseX(); int baseY = region.getBaseY(); Graphics2D graphics = image.createGraphics(); drawMapIcons(graphics, region, z, drawBaseX, drawBaseY); if (labelRegions) { graphics.setColor(Color.WHITE); String str = baseX + "," + baseY + " (" + region.getRegionX() + "," + region.getRegionY() + ")"; graphics.drawString(str, drawBaseX * MAP_SCALE, drawBaseY * MAP_SCALE + graphics.getFontMetrics().getHeight()); } if (outlineRegions) { graphics.setColor(Color.WHITE); graphics.drawRect(drawBaseX * MAP_SCALE, drawBaseY * MAP_SCALE, Region.X * MAP_SCALE, Region.Y * MAP_SCALE); } graphics.dispose(); }
@Override public Dimension render(Graphics2D graphics) { int thickness = borderThickness; int width = preferredSize.width; int height = preferredSize.height; //draw the fill graphics.setColor(fill); graphics.fillRect(thickness, thickness, width - thickness * 2, height - thickness * 2); //because the stroke is centered on the rectangle we draw, we need to translate where we draw the rectangle //this is to ensure that the rectangle we draw is our preferred size int offset = thickness / 2; graphics.setColor(color); graphics.setStroke(stroke); graphics.drawRect(offset, offset, width - thickness, height - thickness); return preferredSize; } }
int point2 = (int)Math.ceil(percent2 * gradientWidth); g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false)); g.fillRect(point1, 0, point2 - point1, gradientHeight); g.setColor(Color.black); g.drawRect(0, 0, gradientWidth, gradientHeight); xPoints[2] = x + handleWidth / 2; if (i == selectedIndex) { g.setColor(colors.get(i)); g.fillPolygon(xPoints, yPoints, 3); g.fillRect(xPoints[1], yPoints[1] + 2, handleWidth + 1, 2); g.setColor(Color.black);
int point2 = (int)Math.ceil(percent2 * gradientWidth); g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false)); g.fillRect(point1, 0, point2 - point1, gradientHeight); g.setColor(Color.black); g.drawRect(0, 0, gradientWidth, gradientHeight); xPoints[2] = x + handleWidth / 2; if (i == selectedIndex) { g.setColor(colors.get(i)); g.fillPolygon(xPoints, yPoints, 3); g.fillRect(xPoints[1], yPoints[1] + 2, handleWidth + 1, 2); g.setColor(Color.black);
@Override public Dimension render(Graphics2D graphics) { ScreenMarker marker = plugin.getCurrentMarker(); if (marker == null) { return null; } int thickness = marker.getBorderThickness(); int offset = thickness / 2; int width = getBounds().width - thickness; int height = getBounds().height - thickness; graphics.setStroke(createStripedStroke(thickness)); graphics.setColor(marker.getColor()); graphics.drawRect(offset, offset, width, height); return getBounds().getSize(); }