Java Code Examples for java.awt.geom.Ellipse2D.Double

The following are top voted examples for showing how to use java.awt.geom.Ellipse2D.Double. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lemon   File: CustomProcessDiagramGenerator.java   View source code 5 votes vote down vote up
/**
 * 绘制任务
 */
protected static void drawTask(int x, int y, int width, int height,
        Graphics2D graphics) {
    RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width,
            height, OFFSET_TASK, OFFSET_TASK);
    graphics.draw(rect);
}
 
Example 2
Project: lemon   File: CustomProcessDiagramGenerator.java   View source code 5 votes vote down vote up
/**
 * 绘制子流程
 */
protected static void drawSubProcess(int x, int y, int width, int height,
        Graphics2D graphics) {
    RoundRectangle2D rect = new RoundRectangle2D.Double(x + 1, y + 1,
            width - 2, height - 2, OFFSET_SUBPROCESS, OFFSET_SUBPROCESS);
    graphics.draw(rect);
}
 
Example 3
Project: CS56-W14-lab06   File: Fish.java   View source code 5 votes vote down vote up
/**
   Constructor

   @param x x coord of upper left corner of fishbody if the fish were a rectangle
   @param y y coord of upper left corner of fishbody if the fish were a rectangle
   @param width width of the fish
   @param height of fish
 */

public Fish(double x, double y, double width, double height)
{
    
    // Rather than having to scale at the end, we can just
    // draw things the right way to begin with, using the
    // x, y, width and height.   If you haven't already
    // hard coded a particular drawing, this may be an easier
    // way.
    Ellipse2D.Double fishbody = new Ellipse2D.Double (x , y , width, height);
    Line2D.Double toptail = new Line2D.Double (x - width/4.0 , y , x , y + height/2.0);
    Line2D.Double middletail = new Line2D.Double ( x - width/4.0, y , x - width/4.0 , y + height);
    Line2D.Double bottomtail = new Line2D.Double ( x - width/4.0, y + height , x , y + height/2.0);
    Ellipse2D.Double fisheye = new Ellipse2D.Double(x + 0.70* width , y + height/3.0 , width / 8.0 , width/8.0);
   
    
    // put the whole fish together
  
    GeneralPath wholeFish = this.get();
    wholeFish.append(fishbody, false);
    wholeFish.append(toptail, false);
    wholeFish.append(middletail, false);
    wholeFish.append(bottomtail, false);
    wholeFish.append(fisheye,  false);

    
}
 
Example 4
Project: agar.io   File: EZ.java   View source code 4 votes vote down vote up
@Override public Shape getBounds() {
  return EZElement.boundHelper(new Ellipse2D.Double(-circle.width / 2, -circle.height / 2, circle.width,
      circle.height), this);
}
 
Example 5
Project: lemon   File: CustomProcessDiagramGenerator.java   View source code 4 votes vote down vote up
/**
 * 绘制任务
 */
protected static void drawEvent(int x, int y, int width, int height,
        Graphics2D graphics) {
    Double circle = new Ellipse2D.Double(x, y, width, height);
    graphics.draw(circle);
}
 
Example 6
Project: agar.io   File: EZ.java   View source code 3 votes vote down vote up
/**
 * Creates a circle with the given specifications.
 * While this constructor is available for usage, it is highly recommended that you do not use this.
 * Instead call EZ.addCircle() method which will perform additional background actions to get the circle to display
 * on the window properly.
 * 
 * @param x center coordinate.
 * @param y center coordinate.
 * @param width of the circle.
 * @param height of the circle.
 * @param color to use when drawing.
 * @param filled status of whether the drawn circle should be a solid of the given color.
 */
public EZCircle(int x, int y, int width, int height, Color color, boolean filled) {
  circle = new Ellipse2D.Double(x - width / 2, y - height / 2, width, height);
  // transformCircle = new Ellipse2D.Double(-width/2,-height/2,width,height);
  this.color = color;
  this.filled = filled;
  xcd = x;
  ycd = y;
}