Search in sources :

Example 1 with Ellipse2D

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&nbsp;+&nbsp;1</code> pixels wide
     * and <code>height&nbsp;+&nbsp;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);
}
Also used : Ellipse2D(java.awt.geom.Ellipse2D)

Example 2 with Ellipse2D

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));
}
Also used : BasicStroke(java.awt.BasicStroke) Area(java.awt.geom.Area) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) Color(java.awt.Color) Ellipse2D(java.awt.geom.Ellipse2D)

Example 3 with Ellipse2D

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);
    }
}
Also used : Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) Paint(java.awt.Paint) Ellipse2D(java.awt.geom.Ellipse2D) Point(java.awt.Point) Paint(java.awt.Paint)

Example 4 with Ellipse2D

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);
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) Paint(java.awt.Paint) Ellipse2D(java.awt.geom.Ellipse2D)

Example 5 with Ellipse2D

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);
}
Also used : Ellipse2D(java.awt.geom.Ellipse2D)

Aggregations

Ellipse2D (java.awt.geom.Ellipse2D)15 Paint (java.awt.Paint)6 BasicStroke (java.awt.BasicStroke)3 Stroke (java.awt.Stroke)3 Point (java.awt.Point)2 Area (java.awt.geom.Area)2 Density (com.android.resources.Density)1 ScreenRatio (com.android.resources.ScreenRatio)1 ScreenSize (com.android.resources.ScreenSize)1 Color (java.awt.Color)1 Arc2D (java.awt.geom.Arc2D)1 Line2D (java.awt.geom.Line2D)1 Path2D (java.awt.geom.Path2D)1 RoundRectangle2D (java.awt.geom.RoundRectangle2D)1 EntityCollection (org.jfree.chart.entity.EntityCollection)1