Package gwt.g2d.client.graphics

Examples of gwt.g2d.client.graphics.Surface


  public AbstractApp(Surface surface) {
    primarySurface = surface;
  }
 
  public AbstractApp(int width, int height) {
    this(new Surface(width, height));
  }
View Full Code Here


  public AbstractApp(int width, int height) {
    this(new Surface(width, height));
  }
 
  public AbstractApp(Vector2 size) {
    this(new Surface(size));
  }
View Full Code Here

 
  /**
   * Creates a new surface for testing.
   */
  private static Surface createSurface() {
    return new Surface(1, 1);
  }
View Full Code Here

    testShadowBlur();
    testSaveRestore();   
  }
 
  private void testSaveRestore() {
    Surface surface = createSurface();
    surface.setGlobalAlpha(.5)
        .setGlobalCompositeOperation(Composition.SOURCE_OVER)
        .setLineCap(LineCap.BUTT)
        .setLineJoin(LineJoin.ROUND)
        .setLineWidth(5.0)
        .setMiterLimit(5.0)
        .setFont("20px sans-serif")
        .setTextAlign(TextAlign.CENTER)
        .setTextBaseline(TextBaseline.TOP)
        .setShadowOffsetX(1.0)
        .setShadowOffsetY(1.0)
        .setShadowBlur(1.0);   
    surface.save();
    surface.setGlobalAlpha(1.0)
        .setGlobalCompositeOperation(Composition.SOURCE_IN)
        .setLineCap(LineCap.ROUND)
        .setLineJoin(LineJoin.MITER)
        .setLineWidth(1.0)
        .setMiterLimit(1.0)
        .setFont("10px sans-serif")
        .setTextAlign(TextAlign.END)
        .setTextBaseline(TextBaseline.BOTTOM)
        .setShadowOffsetX(5.0)
        .setShadowOffsetY(5.0)
        .setShadowBlur(5.0);
   
    surface.restore();
    testResult("Restore Global Alpha", .5, surface.getGlobalAlpha());
    testResult("Restore Global Composition", Composition.SOURCE_OVER,
        surface.getGlobalCompositeOperation());
    testResult("Restore Line Cap", LineCap.BUTT, surface.getLineCap());
    testResult("Restore Line Join", LineJoin.ROUND, surface.getLineJoin());
    testResult("Restore Line Width", 5.0, surface.getLineWidth());
    testResult("Restore Miter Limit", 5.0, surface.getMiterLimit());
    testResult("Restore Font", "20px sans-serif", surface.getFont());
    testResult("Restore Text Align", TextAlign.CENTER, surface.getTextAlign());
    testResult("Restore Text Baseline", TextBaseline.TOP, surface.getTextBaseline());
    testResult("Restore Shadow Offset X", 1.0, surface.getShadowOffsetX());
    testResult("Restore Shadow Offset Y", 1.0, surface.getShadowOffsetY());
    testResult("Restore Shadow Blur", 1.0, surface.getShadowBlur());   
  }
View Full Code Here

    testResult("Restore Shadow Offset Y", 1.0, surface.getShadowOffsetY());
    testResult("Restore Shadow Blur", 1.0, surface.getShadowBlur());   
  }

  private void testFont() {
    Surface surface = createSurface();
    testResult("Font", "10px sans-serif", surface.getFont());
    testResult("Font", "20pt Arial",
        surface.setFont("20pt Arial").getFont());
    testResult("Font", "italic 400 12px/2 Unknown Font, sans-serif",
        surface.setFont("italic 400 12px/2 Unknown Font, sans-serif").getFont());
  }
View Full Code Here

    testResult("Font", "italic 400 12px/2 Unknown Font, sans-serif",
        surface.setFont("italic 400 12px/2 Unknown Font, sans-serif").getFont());
  }

  private void testGlobalAlpha() {
    Surface surface = createSurface();
    testResult("Global Alpha", 1.0, surface.getGlobalAlpha());
    for (int i = 0; i < NUM_RANDOM_TESTS; i++) {
      double randNumber = Random.nextDouble();
      testResult("Global Alpha", randNumber,
          surface.setGlobalAlpha(randNumber).getGlobalAlpha());
    }
  }
View Full Code Here

          surface.setGlobalAlpha(randNumber).getGlobalAlpha());
    }
  }

  private void testGlobalComposition() {
    Surface surface = createSurface();
    testResult("Global Composition", Composition.SOURCE_OVER,
        surface.getGlobalCompositeOperation());
    for (Composition v : Composition.values()) {
      testResult("Global Composition", v, surface
          .setGlobalCompositeOperation(v).getGlobalCompositeOperation());
    }
  }
View Full Code Here

          .setGlobalCompositeOperation(v).getGlobalCompositeOperation());
    }
  }

  private void testLineCap() {
    Surface surface = createSurface();
    testResult("Line Cap", LineCap.BUTT, surface.getLineCap());
    for (LineCap v : LineCap.values()) {
      testResult("Line Cap", v, surface.setLineCap(v).getLineCap());
    }
  }
View Full Code Here

      testResult("Line Cap", v, surface.setLineCap(v).getLineCap());
    }
  }

  private void testLineJoin() {
    Surface surface = createSurface();
    testResult("Line Join", LineJoin.MITER, surface.getLineJoin());
    for (LineJoin v : LineJoin.values()) {
      testResult("Line Join", v, surface.setLineJoin(v).getLineJoin());
    }
  }
View Full Code Here

      testResult("Line Join", v, surface.setLineJoin(v).getLineJoin());
    }
  }

  private void testLineWidth() {
    Surface surface = createSurface();
    testResult("Line Width", 1.0, surface.getLineWidth());
    for (int i = 0; i < NUM_RANDOM_TESTS; i++) {
      double randNumber = Random.nextDouble() * 50;
      testResult("Line Width", randNumber,
          surface.setLineWidth(randNumber).getLineWidth());
    }
  }
View Full Code Here

TOP

Related Classes of gwt.g2d.client.graphics.Surface

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.