List of usage examples for java.awt Graphics2D fillOval
public abstract void fillOval(int x, int y, int width, int height);
From source file:org.squidy.designer.model.PipeShape.java
@Override protected void paintDebug(PPaintContext paintContext) { super.paintDebug(paintContext); Graphics2D g = paintContext.getGraphics(); if (DebugConstants.PAINTING_BOUNDS) { g.setColor(DebugConstants.COLOR_BOUNDS); g.draw(getBoundsReference());//from w w w .j a v a 2 s . c o m } if (DebugConstants.PAINTING_FULL_BOUNDS) { g.setColor(DebugConstants.COLOR_FULL_BOUNDS); g.draw(getFullBounds()); } if (DebugConstants.PAINTING_CENTER) { g.setColor(DebugConstants.COLOR_CENTER); PBounds bounds = getBoundsReference(); g.fillOval((int) bounds.getCenterX() - 5, (int) bounds.getCenterY() - 5, 10, 10); } }
From source file:org.squidy.designer.zoom.impl.PortShape.java
/** * @param paintContext/*from w ww . j a v a 2 s . com*/ */ @Override protected void paintShape(PPaintContext paintContext) { super.paintShape(paintContext); Graphics2D g = paintContext.getGraphics(); PBounds bounds = getBoundsReference(); int x = (int) bounds.getX(); int y = (int) bounds.getY(); int width = (int) bounds.getWidth(); int height = (int) bounds.getHeight(); g.setColor(innerColor); g.fillOval(x, y, width, width); Stroke defaultStroke = g.getStroke(); g.setStroke(STROKE_PORT); g.setColor(Color.BLACK); g.drawOval(x, y, width, width); g.drawLine(x + 20, height - 20, x + width - 20, height - 20); g.drawLine(x + width - 50, height - 40, x + width - 20, height - 20); g.drawLine(x + width - 50, height + 0, x + width - 20, height - 20); g.setStroke(defaultStroke); // ////////////////// if (isCreatingEdge) { Graphics2D g2d = paintContext.getGraphics(); g2d.setColor(Color.GRAY); // // Paint label. // if (showLabel) { // paintLabel(paintContext); // Paint edge if is creating edge. if (isCreatingEdge) { paintCreatingEdge(paintContext); } } }
From source file:org.squidy.designer.zoom.impl.VisualizationShape.java
@Override protected void paintShapeZoomedIn(PPaintContext paintContext) { Graphics2D g = paintContext.getGraphics(); PBounds bounds = getBoundsReference(); // PBounds cameraBounds = getBoundsReference();// paintContext.getCamera().getFullBoundsReference(); // double cameraX = cameraBounds.getX() - 20; // double cameraY = cameraBounds.getY(); // double cameraWidth = cameraBounds.getWidth() + 40; // double cameraHeight = cameraBounds.getHeight(); // g.setColor(Color.WHITE); // g.fillRect((int) cameraX, (int) cameraY, (int) cameraWidth, (int) cameraHeight); ////from ww w . j a v a2 s.co m // g.setColor(Color.BLACK); // g.fillRect((int) cameraX, (int) (cameraY + cameraHeight / 4), (int) cameraWidth, (int) (cameraHeight / 2)); g.setFont(fontLables); // Paint node labels. paintNodeLabels(paintContext); super.paintShapeZoomedIn(paintContext); // Paint headline. if (!isShowNavigation()) { paintHeadline(paintContext); } g.setFont(fontSmall); // Translate the current graphics position to 1/4 width and 1/4 height // of this shape. TRANSLATION.setToTranslation((int) (bounds.getWidth() / 4), (int) (bounds.getHeight() / 4)); paintContext.pushTransform(TRANSLATION); // Scale up visualization are because of int constraints to avoid // mathematical round failure. int maxWidth = (int) ((bounds.getWidth() / 2) * 10); int maxHeight = (int) ((bounds.getHeight() / 2) * 10); paintContext.pushTransform(SCALE_TRANSFROM); PlotContext plotContext = new PlotContext(paintContext, maxWidth, maxHeight, SCALE_TRANSFORM_SCALING, sampleTime); long currentTime = System.currentTimeMillis(); for (IDataContainer dataContainer : DATA_QUEUE) { if ((currentTime - dataContainer.getTimestamp()) >= sampleTime) { DATA_QUEUE.remove(dataContainer); continue; } // Delegates plot of data to visualization. visualizations[visualizationIndex].plotData(plotContext, dataContainer); } // Paints the grid. visualizations[visualizationIndex].paintContextual(paintContext, plotContext); paintContext.popTransform(SCALE_TRANSFROM); // Pop transform translation. paintContext.popTransform(TRANSLATION); g.setFont(fontFPS); g.drawString("FPS: " + currentFPS, (int) (bounds.getWidth() / 2 - 50), (int) (bounds.getHeight() - 100)); g.setFont(fontHeadline.deriveFont(18f)); g.setColor(Color.RED); g.fillOval((int) (bounds.getWidth() - 115), (int) (bounds.getHeight() / 2 - 20), 10, 10); g.setColor(Color.BLACK); g.drawString("x-value", (int) (bounds.getWidth() - 100), (int) (bounds.getHeight() / 2 - 10)); g.setColor(Color.BLUE); g.fillOval((int) (bounds.getWidth() - 115), (int) (bounds.getHeight() / 2 + 20), 10, 10); g.setColor(Color.BLACK); g.drawString("y-value", (int) (bounds.getWidth() - 100), (int) (bounds.getHeight() / 2 + 30)); }
From source file:org.squidy.designer.zoom.NavigationShape.java
@Override protected void paintShapeZoomedIn(PPaintContext paintContext) { super.paintShapeZoomedIn(paintContext); Graphics2D g = (Graphics2D) paintContext.getGraphics(); if (showNavigation) {// && !isHierarchicalZoomInProgress()) { PBounds bounds = getBoundsReference(); int x = (int) bounds.getX(); int y = (int) bounds.getY(); int width = (int) bounds.getWidth(); int height = (int) bounds.getHeight(); g.setColor(Constants.Color.COLOR_SHAPE_BACKGROUND); if (isRenderPrimitiveRect()) g.fillRect(x, y, width, 60); else {/*from w ww. jav a 2 s.c om*/ g.clearRect(x, y, width, 60); g.fillRoundRect(x, y, width, 60, 25, 25); } g.setColor(Constants.Color.COLOR_SHAPE_BORDER); if (isRenderPrimitiveRect()) g.drawRect(x, y, width, 60); else g.drawRoundRect(x, y, width, 60, 25, 25); g.setFont(fontBreadcrumb); if (titleBounds == null) { FontMetrics fm = g.getFontMetrics(); titleBounds = new Rectangle2D.Double(bounds.getX() + 455 + titleGap, bounds.getY() + 25 - fm.getHeight(), FontUtils.getWidthOfText(fm, getTitle()) + 10, fm.getHeight() + 5); } // Font font = internalFont.deriveFont(3.2f); for (int i = 0; i < 3; i++) { if (isRenderPrimitiveRect()) g.fillRect((int) (bounds.getX() + 430), (int) bounds.getY() + i * 15 + 10, 5, 10); else g.fillOval((int) (bounds.getX() + 430), (int) bounds.getY() + i * 15 + 10, 5, 10); } if (!ShapeUtils.isApparent(titleInputWrapper)) { g.drawString(getTitle(), (int) (bounds.getX() + 460 + titleGap), (int) (bounds.getY() + 25)); } if (croppedBreadcrumb == null) { croppedBreadcrumb = FontUtils.createCroppedLabelIfNecessary(g.getFontMetrics(), getBreadcrumb(), (int) bounds.getWidth() * 10 - 450); } g.drawString(croppedBreadcrumb, (int) (bounds.getX() + 460), (int) (bounds.getY() + 50)); } }
From source file:org.ujmp.jung.VertexIconTransformer.java
public Icon transform(final N v) { return new Icon() { public int getIconHeight() { return 10; }/* w ww . ja v a 2s. c o m*/ public int getIconWidth() { return 10; } public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2d = (Graphics2D) g; if (pickedVertexState.isPicked(v)) { g2d.setColor(UIDefaults.SELECTEDCOLOR); } else { g2d.setColor(ColorUtil.fromObject(v)); } g2d.fillOval(x, y, 10, 10); g2d.setColor(new Color(150, 150, 150, 150)); g2d.drawOval(x, y, 10, 10); } }; }
From source file:org.uva.itast.blended.omr.OMRUtils.java
/** * @param x/* w w w. ja v a 2s .c o m*/ * in pixels * @param y * in pixels */ public static void markPointInImage(PageImage pageImage, int x, int y) { Graphics2D g = pageImage.getReportingGraphics(); // undo the transformation to pixeles g.setColor(Color.WHITE); g.fillOval((int) (x - 1), (int) (y - 1), (int) (2), (int) (2)); // g.drawRect(i-w/2-1, j-h/2-1, w, h); g.setColor(Color.BLACK); g.drawOval((int) (x - 1), (int) (y - 1), (int) (2), (int) (2)); // g.drawRect(i-w/2, j-h/2, w, h); }
From source file:pt.lsts.neptus.plugins.wg.WgCtdLayer.java
private boolean paintHistory(Graphics2D g, StateRenderer2D renderer) { boolean paintedToRender = false; Long endMark = dataDateEnd.getTime(); Long timeMark = dataDateStart.getTime(); CtdData dataPoint;//from w w w . j a va2s . co m // double tempMaxTemp, tempMinTemp; // timeMark = ctdHistory.higherKey(timeMark); // if (timeMark != null) { // dataPoint = ctdHistory.get(timeMark); // tempMaxTemp = dataPoint.temperature; // tempMinTemp = dataPoint.temperature; // } // else { // tempMaxTemp = maxTemp; // tempMinTemp = minTemp; // } Color color; Graphics2D gt; Point2D pt; int width = (renderer.getZoom() > 1) ? (int) (5 * renderer.getZoom()) : 5; if (renderer.getZoom() < 0.002) { timeMark = ctdHistory.higherKey(timeMark); if (timeMark != null && timeMark <= endMark) { dataPoint = ctdHistory.get(timeMark); pt = renderer.getScreenPosition(dataPoint.location); if (isVisibleInRender(pt, renderer)) { gt = (Graphics2D) g.create(); color = genColor(dataPoint.temperature); gt.setColor(color); gt.fillOval((int) pt.getX(), (int) pt.getY(), 10, 10); gt.dispose(); paintedToRender = true; } } } else { try { timeMark = ctdHistory.higherKey(timeMark); // TODO avoid for in case of being too far from location shown on map for (timeMark = ctdHistory.higherKey(timeMark); timeMark != null && timeMark <= endMark; timeMark = ctdHistory.higherKey(timeMark + 1)) { dataPoint = ctdHistory.get(timeMark); pt = renderer.getScreenPosition(dataPoint.location); if (!isVisibleInRender(pt, renderer)) { continue; } // check if it is visible gt = (Graphics2D) g.create(); color = genColor(dataPoint.temperature); gt.setColor(color); gt.fillOval((int) pt.getX(), (int) pt.getY(), width, width); gt.dispose(); paintedToRender = true; } } catch (NullPointerException e) { System.out.println("timeMark"); } } return paintedToRender; }
From source file:se.trixon.almond.GraphicsHelper.java
public static void fillCircle(int x, int y, int radius, Graphics2D graphics2D) { graphics2D.fillOval(x - radius, y - radius, radius * 2, radius * 2); }