Package gwt.g2d.client.graphics.shapes

Examples of gwt.g2d.client.graphics.shapes.ShapeBuilder$CustomShape


 
  /**
   * Draws onto the surface using {@link ShapeBuilder}.
   */
  private void drawWithShapeBuilder(Surface surface) {
    surface.strokeShape(new ShapeBuilder()
        .drawLineSegment(40, 20, 180, 20)
        .drawQuadraticCurveTo(200, 20, 200, 40)
        .drawLineTo(200, 180)
        .drawQuadraticCurveTo(200, 200, 180, 200)
        .drawLineTo(40, 200)
        .drawQuadraticCurveTo(20, 200, 20, 180)
        .drawLineTo(20, 40)
        .drawQuadraticCurveTo(20, 20, 40, 20)
        .moveTo(50, 50)
        .drawArc(50, 50, 15, (float) Math.toRadians(30), (float) Math.toRadians(-30), false)
        .build());
    surface.strokeShape(new ShapeBuilder()
        .drawEllipse(20, 100, 180, 100)
        .build());
    ShapeBuilder dotShapeBuilder = new ShapeBuilder();
    for (int i = 0; i < 8; i++) {
      dotShapeBuilder.drawCircle(80 + i * 12, 50, 1);
    }
    surface.fillShape(dotShapeBuilder.build());
  }
View Full Code Here


  public void initialize() {
    add(new Label("This demo does not work under IE."));
    Surface originalCanvas = new Surface(300, 300);
    Circle smallCircle = new Circle(150, 150, 140);
    Circle bigCircle = new Circle(150, 150, 150);
    Shape smallCircleShape = new ShapeBuilder().drawCircle(smallCircle).build();
    Shape bigCircleShape = new ShapeBuilder().drawCircle(bigCircle).build();
    Gradient radialGradient = new RadialGradient(new Circle(150, 150, 0), smallCircle)
        .addColorStop(0, KnownColor.RED)
        .addColorStop(1, KnownColor.GREEN);
    originalCanvas.setFillStyle(KnownColor.BLACK)
        .fillShape(bigCircleShape)
View Full Code Here

      if (isLeftButtonDown) {
        surface.setStrokeStyle(KnownColor.BLACK).setLineWidth(5);
      } else if (isRightButtonDown) {
        surface.setStrokeStyle(KnownColor.WHITE).setLineWidth(20);
      }
      surface.strokeShape(new ShapeBuilder()
          .drawLineSegment(lastPosition, new Vector2(event.getX(), event.getY()))
          .build());
      surface.restore();
      lastPosition.set(event.getX(), event.getY());
    }   
View Full Code Here

  }

  private void drawStar(double r) {
    Surface surface = getPrimarySurface();
    surface.save();
    ShapeBuilder shapeBuilder = new ShapeBuilder().moveTo(r, 0);
    for (int i = 0; i < 9; i++) {
      shapeBuilder.rotate(Math.PI / 5);
      if (i % 2 == 0) {
        shapeBuilder.drawLineTo((r / 0.525731) * 0.200811, 0);
      } else {
        shapeBuilder.drawLineTo(r, 0);
      }
    }
    surface.fillShape(shapeBuilder.build())
        .restore();
  }
View Full Code Here

TOP

Related Classes of gwt.g2d.client.graphics.shapes.ShapeBuilder$CustomShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.