use of java.awt.geom.Ellipse2D in project scriptographer by scriptographer.
the class AbstractGraphics2D method drawOval.
/**
* Draws the outline of an oval.
* The result is a circle or ellipse that fits within the
* rectangle specified by the <code>x</code>, <code>y</code>,
* <code>width</code>, and <code>height</code> arguments.
* <p>
* The oval covers an area that is
* <code>width + 1</code> pixels wide
* and <code>height + 1</code> pixels tall.
* @param x the <i>x</i> coordinate of the upper left
* corner of the oval to be drawn.
* @param y the <i>y</i> coordinate of the upper left
* corner of the oval to be drawn.
* @param width the width of the oval to be drawn.
* @param height the height of the oval to be drawn.
* @see java.awt.Graphics#fillOval
*/
public void drawOval(int x, int y, int width, int height) {
Ellipse2D oval = new Ellipse2D.Float(x, y, width, height);
draw(oval);
}
use of java.awt.geom.Ellipse2D in project gephi by gephi.
the class SplineDisplay method paintControlPoint.
private void paintControlPoint(Graphics2D g2, Point2D control) {
double origin_x = xPositionToPixel(control.getX());
double origin_y = yPositionToPixel(control.getY());
double pos = control == control1 ? 0.0 : 1.0;
Ellipse2D outer = getDraggableArea(control);
Ellipse2D inner = new Ellipse2D.Double(origin_x + 2.0 - CONTROL_POINT_SIZE / 2.0, origin_y + 2.0 - CONTROL_POINT_SIZE / 2.0, 8.0, 8.0);
Area circle = new Area(outer);
circle.subtract(new Area(inner));
Stroke stroke = g2.getStroke();
g2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5, new float[] { 5, 5 }, 0));
g2.setColor(new Color(1.0f, 0.0f, 0.0f, 0.4f));
g2.drawLine(0, (int) origin_y, (int) origin_x, (int) origin_y);
g2.drawLine((int) origin_x, (int) origin_y, (int) origin_x, getHeight());
g2.setStroke(stroke);
if (selected == control) {
g2.setColor(new Color(1.0f, 1.0f, 1.0f, 1.0f));
} else {
g2.setColor(new Color(0.8f, 0.8f, 0.8f, 0.6f));
}
g2.fill(inner);
g2.setColor(new Color(0.0f, 0.0f, 0.5f, 0.5f));
g2.fill(circle);
g2.drawLine((int) origin_x, (int) origin_y, (int) xPositionToPixel(pos), (int) yPositionToPixel(pos));
}
use of java.awt.geom.Ellipse2D in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawCatchingEvent.
public void drawCatchingEvent(GraphicInfo graphicInfo, boolean isInterrupting, BufferedImage image, String eventType, double scaleFactor) {
// event circles
Ellipse2D outerCircle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight());
int innerCircleSize = (int) (4 / scaleFactor);
if (innerCircleSize == 0) {
innerCircleSize = 1;
}
int innerCircleX = (int) graphicInfo.getX() + innerCircleSize;
int innerCircleY = (int) graphicInfo.getY() + innerCircleSize;
int innerCircleWidth = (int) graphicInfo.getWidth() - (2 * innerCircleSize);
int innerCircleHeight = (int) graphicInfo.getHeight() - (2 * innerCircleSize);
Ellipse2D innerCircle = new Ellipse2D.Double(innerCircleX, innerCircleY, innerCircleWidth, innerCircleHeight);
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
g.setPaint(EVENT_COLOR);
g.fill(outerCircle);
g.setPaint(EVENT_BORDER_COLOR);
if (isInterrupting == false)
g.setStroke(NON_INTERRUPTING_EVENT_STROKE);
g.draw(outerCircle);
g.setStroke(originalStroke);
g.setPaint(originalPaint);
g.draw(innerCircle);
if (image != null) {
// calculate coordinates to center image
int imageX = (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / 2 * scaleFactor));
int imageY = (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / 2 * scaleFactor));
if (scaleFactor == 1.0 && "timer".equals(eventType)) {
// move image one pixel to center timer image
imageX++;
imageY++;
}
g.drawImage(image, imageX, imageY, (int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null);
}
}
use of java.awt.geom.Ellipse2D in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawNoneEndEvent.
public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
g.setPaint(EVENT_COLOR);
Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight());
g.fill(circle);
g.setPaint(EVENT_BORDER_COLOR);
if (scaleFactor == 1.0) {
g.setStroke(END_EVENT_STROKE);
} else {
g.setStroke(new BasicStroke(2.0f));
}
g.draw(circle);
g.setStroke(originalStroke);
g.setPaint(originalPaint);
}
use of java.awt.geom.Ellipse2D in project poi by apache.
the class SLGraphics method fillOval.
/**
* Fills an oval bounded by the specified rectangle with the
* current color.
* @param x the <i>x</i> coordinate of the upper left corner
* of the oval to be filled.
* @param y the <i>y</i> coordinate of the upper left corner
* of the oval to be filled.
* @param width the width of the oval to be filled.
* @param height the height of the oval to be filled.
* @see java.awt.Graphics#drawOval
*/
public void fillOval(int x, int y, int width, int height) {
Ellipse2D oval = new Ellipse2D.Double(x, y, width, height);
fill(oval);
}
Aggregations