Example usage for com.google.gwt.widgetideas.graphics.client Color Color

List of usage examples for com.google.gwt.widgetideas.graphics.client Color Color

Introduction

In this page you can find the example usage for com.google.gwt.widgetideas.graphics.client Color Color.

Prototype

public Color(int r, int g, int b) 

Source Link

Document

Create a new Color object with the specified RGB values.

Usage

From source file:com.google.gwt.demos.gwtcanvas.client.ParticleDemo.java

License:Apache License

public void drawDemo() {
    canvas.resize(width, height);//from   w  ww.  j  a  va 2 s  .c  om

    particles = new Particle[numParticles];

    for (int i = 0; i < particles.length; i++) {
        particles[i] = new Particle();
    }
    canvas.saveContext();
    canvas.setLineWidth(2);
    canvas.setStrokeStyle(new Color(255, 0, 0));

    t = new Timer() {
        public void run() {
            renderingLoop();
        }
    };
    t.schedule(10);
}

From source file:com.objetdirect.gwt.umlapi.client.gfx.IncubatorGfxPlatform.java

License:Open Source License

public Widget makeCanvas(final int width, final int height, final GfxColor backgroundColor) {
    final IncubatorCanvasBridge incubatorCanvasBridge = new IncubatorCanvasBridge(width, height);
    // Default values :
    incubatorCanvasBridge.setLineWidth(1);
    incubatorCanvasBridge.setStrokeStyle(Color.BLUEVIOLET);
    incubatorCanvasBridge.setBackgroundColor(
            new Color(backgroundColor.getRed(), backgroundColor.getBlue(), backgroundColor.getGreen()
            /*/*from   ww w .j av  a2  s  .  c  o  m*/
             * , backgroundColor.getAlpha() Disabled to ensure#@&~#! IE compatibility
             */
            ));
    incubatorCanvasBridge.clear();
    canvasBridges.put((GWTCanvasWithListeners) incubatorCanvasBridge.getWidget(), incubatorCanvasBridge);
    return incubatorCanvasBridge.getWidget();
}

From source file:org.utgenome.gwt.utgb.client.canvas.ColorUtil.java

License:Apache License

public static Color toColor(String hex) {
    if (hex.startsWith("#"))
        hex = hex.substring(1);/*  w w  w  .j  a va 2  s .c o  m*/

    int r = Integer.parseInt(hex.substring(0, 2), 16);
    int g = Integer.parseInt(hex.substring(2, 4), 16);
    int b = Integer.parseInt(hex.substring(4, 6), 16);
    Color c = new Color(r, g, b);
    return c;
}