Package com.google.gwt.canvas.dom.client

Examples of com.google.gwt.canvas.dom.client.Context2d.fillRect()


    // add 2d context, resize internal size, should have no effect
    Context2d context = canvas1.getContext2d();
    canvas1.setCoordinateSpaceHeight(140);
    canvas1.setCoordinateSpaceWidth(160);
    context.fillRect(2, 2, 300, 300);

    assertEquals(41, canvas1.getOffsetHeight());
    assertEquals(61, canvas1.getOffsetWidth());
  }
View Full Code Here


public class Test {
  public void bla() {

    Context2d ctx = Canvas.createIfSupported().getContext2d();

    ctx.fillRect(0, 0, 150, 150); // Draw a rectangle with default settings
    ctx.save(); // Save the default state

    ctx.setFillStyle("#09F"); // Make changes to the settings
    ctx.fillRect(15, 15, 120, 120); // Draw a rectangle with new settings
View Full Code Here

    ctx.fillRect(0, 0, 150, 150); // Draw a rectangle with default settings
    ctx.save(); // Save the default state

    ctx.setFillStyle("#09F"); // Make changes to the settings
    ctx.fillRect(15, 15, 120, 120); // Draw a rectangle with new settings

    ctx.save(); // Save the current state
    ctx.setFillStyle("#FFF"); // Make changes to the settings
    ctx.setGlobalAlpha(0.5);
    ctx.fillRect(30, 30, 90, 90); // Draw a rectangle with new settings
View Full Code Here

    ctx.fillRect(15, 15, 120, 120); // Draw a rectangle with new settings

    ctx.save(); // Save the current state
    ctx.setFillStyle("#FFF"); // Make changes to the settings
    ctx.setGlobalAlpha(0.5);
    ctx.fillRect(30, 30, 90, 90); // Draw a rectangle with new settings

    ctx.restore(); // Restore previous state
    ctx.fillRect(45, 45, 60, 60); // Draw a rectangle with restored settings

    ctx.restore(); // Restore original state
View Full Code Here

    ctx.setFillStyle("#FFF"); // Make changes to the settings
    ctx.setGlobalAlpha(0.5);
    ctx.fillRect(30, 30, 90, 90); // Draw a rectangle with new settings

    ctx.restore(); // Restore previous state
    ctx.fillRect(45, 45, 60, 60); // Draw a rectangle with restored settings

    ctx.restore(); // Restore original state
    ctx.fillRect(60, 60, 30, 30); // Draw a rectangle with restored settings
  }
}
View Full Code Here

    ctx.restore(); // Restore previous state
    ctx.fillRect(45, 45, 60, 60); // Draw a rectangle with restored settings

    ctx.restore(); // Restore original state
    ctx.fillRect(60, 60, 30, 30); // Draw a rectangle with restored settings
  }
}
View Full Code Here

    private void render() {
        Context2d context = canvas.getContext2d();
        context.setFillStyle("white");
        context.setStrokeStyle("grey");
        context.fillRect(0, 0, 600, 600);
        context.save();
        context.translate(0, 600);
        context.scale(1, -1);
        context.scale(100, 100);
        context.setLineWidth(0.01);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.