Package com.google.gwt.canvas.client

Examples of com.google.gwt.canvas.client.Canvas


    }
    if(redMushroom!=null)
      return redMushroom;
   
   
    Canvas canvas = Canvas.createIfSupported();
      canvas.setCoordinateSpaceWidth(width);
      canvas.setCoordinateSpaceHeight(height);
      Context2d context = canvas.getContext2d();
     
        // Draw Mushroom stem
    drawStem(context);
     
    //Now draw Muhsroom Head
View Full Code Here


    }
    if(blueMushroom!=null)
      return blueMushroom;
   
   
    Canvas canvas = Canvas.createIfSupported();
      canvas.setCoordinateSpaceWidth(width);
      canvas.setCoordinateSpaceHeight(height);
      Context2d context = canvas.getContext2d();
     
        // Draw Mushroom stem
    drawStem(context);
     
    //Now draw Muhsroom Head
View Full Code Here

    }
    if(greenMushroom!=null)
      return greenMushroom;
   
   
    Canvas canvas = Canvas.createIfSupported();
      canvas.setCoordinateSpaceWidth(width);
      canvas.setCoordinateSpaceHeight(height);
      Context2d context = canvas.getContext2d();
     
        // Draw Mushroom stem
    drawStem(context);
     
    //Now draw Muhsroom Head
View Full Code Here

    }
    if(greenMushroom!=null)
      return greenMushroom;
   
   
    Canvas canvas = Canvas.createIfSupported();
      canvas.setCoordinateSpaceWidth(width);
      canvas.setCoordinateSpaceHeight(height);
      Context2d context = canvas.getContext2d();
     
        // Draw Mushroom stem
    drawStem(context);
     
    //Now draw Muhsroom Head
View Full Code Here

      context.stroke();
      context.fill();
  }
 
  public static CanvasElement arrow(int width, int height){
    Canvas canvas = Canvas.createIfSupported();
      canvas.setCoordinateSpaceWidth(width);
      canvas.setCoordinateSpaceHeight(height);
      Context2d context = canvas.getContext2d();
   
    int canvasHeight = height;
    int canvasWidth = width;
   
        CanvasGradient canvasGradient = context.createLinearGradient(0,canvasHeight/2,canvasWidth,canvasHeight/2);
        canvasGradient.addColorStop(0, "rgba(255, 200, 0, 1)");
        canvasGradient.addColorStop(1, "rgba(200,20,120, 1)");
    context.setFillStyle(canvasGradient);
    context.setStrokeStyle(canvasGradient);
   
    context.beginPath();
    context.moveTo(0 , canvasHeight/3);
    context.lineTo(canvasWidth*2/3, canvasHeight/3);
    context.lineTo(canvasWidth*2/3, 0);
    context.lineTo(canvasWidth, canvasHeight/2);
    context.lineTo(canvasWidth*2/3, canvasHeight);
    context.lineTo(canvasWidth*2/3, canvasHeight*2/3);
    context.lineTo(0, canvasHeight*2/3);
    context.lineTo(0, canvasHeight/3);
    context.closePath();
    context.stroke();
    context.fill();
   
    return canvas.getCanvasElement();
  }
View Full Code Here

   
  public Garden(Context2d _context){
    this.context = _context;
    this.canvasHeight = context.getCanvas().getHeight();
    this.canvasWidth = context.getCanvas().getWidth();
    Canvas backBufferCanvas = Canvas.createIfSupported();
      backBufferCanvas.setCoordinateSpaceWidth(_context.getCanvas().getWidth());
      backBufferCanvas.setCoordinateSpaceHeight(_context.getCanvas().getHeight());
      backBuffer = backBufferCanvas.getContext2d();
     
  //  blueMshrm = new MushroomGroup(100,100,2);

        createHexagons();
        backBuffer.drawImage(context.getCanvas(), 0, 0);// saving 'context' so we don't have to do all that processing again
View Full Code Here

        GWT.getHostPageBaseURL() + URL_SERVICE);

    // 匿名インナークラス受渡し用変数へ格納する
    this.resultPanel = this;

    final Canvas canvas = Canvas.createIfSupported();
    //final Context2d ctx = null;
    if(canvas==null){
      GWT.log("[ResultPanel:constructor] canvas not support");
      // テーブルで代替
      FlexTable resultTbl = new FlexTable();
      if(y>0) resultTbl.setText(00, TBL_2ND_EXT + TBL_COORD_X);
      else resultTbl.setText(01, TBL_2ND_EXT + TBL_COORD_X);
      resultTbl.setText(01, TBL_1ST + TBL_COORD_Y);

      resultTbl.setText(1, 0, Integer.toString(x));
      resultTbl.setText(1, 1, Integer.toString(y));
      resultTbl.setBorderWidth(1);
      resultTbl.setStyleName("center");

      this.add(resultTbl);
      GWT.log("[ResultPanel:constructor] added table");
    }else{
//    if(canvas!=null){
      canvas.setCoordinateSpaceWidth(400);
      canvas.setCoordinateSpaceHeight(400);
      Context2d ctx = canvas.getContext2d();
      // グラフベースを描画
      ResultPanel.drawGraphBase(ctx);
      // 結果を描画
      ResultPanel.writePoint(ctx, x, y, 5,
          Utils.getTypeColor(y, x));
      // ツールチップでスコア詳細をだす
      canvas.setTitle(ClientUtils.getTooltipMsg(x, y));
      this.add(canvas);
      GWT.log("[ResultPanel:constructor] added rader canvas");
    }

    // 非同期で統計情報を表示する
    GWT.log("[ResultPanel:constructor] prepare requesting summary " +
        "to server");

   
    if(canvas!=null){
      service.getResults(new AsyncCallback<List<long[]>>(){

        @Override
        public void onFailure(Throwable caught) {
          GWT.log("[ResultPanel:constructor>Async:RESULTS:" +
              "onFailure()] called", caught);
        }

        @Override
        public void onSuccess(List<long[]> result) {
          long elapse = System.currentTimeMillis();
          GWT.log("[ResultPanel:constructor>Async:RESULTS:" +
              "onFailure()] start: "+result);
          Context2d ctx = canvas.getContext2d();
          ResultPanel.writeGrayPoints(ctx, result);
          ResultPanel.writePoint(ctx, x, y, 5,
              Utils.getTypeColor(y, x));
          GWT.log("[ResultPanel:constructor>Async:RESULTS:" +
              "onFailure()] end: " +
View Full Code Here

        return scaleImage(image, scaleToRatio, scaleToRatio);
    }

    public static ImageData scaleImage(Image image, double scaleToRatioh, double scaleToRatiow) {

        Canvas canvasTmp = Canvas.createIfSupported();
        Context2d context = canvasTmp.getContext2d();

        double ch = (image.getHeight() * scaleToRatioh);// + 100;
        double cw = (image.getWidth() * scaleToRatiow); //+ 100;

        canvasTmp.setCoordinateSpaceHeight((int) ch);
        canvasTmp.setCoordinateSpaceWidth((int) cw);

        ImageElement imageElement = ImageElement.as(image.getElement());

        // s = source
        // d = destination
View Full Code Here

        return imageData;
    }

    public static ImageData fillImage(Image image, double cw, double ch) {
        Canvas canvasTmp = Canvas.createIfSupported();
        Context2d context = canvasTmp.getContext2d();

        //double ch = (image.getHeight() * scaleToRatioh) + 100;
        //double cw = (image.getWidth() * scaleToRatiow) + 100;

        canvasTmp.setCoordinateSpaceHeight((int) ch);
        canvasTmp.setCoordinateSpaceWidth((int) cw);

        ImageElement imageElement = ImageElement.as(image.getElement());

        // s = source
        // d = destination
View Full Code Here

  public  static ImageData scaleImage(Image image, double scaleToRatio) {
    return scaleImage(image, scaleToRatio,scaleToRatio);   
  }
  public  static ImageData scaleImage(Image image, double scaleToRatioh,double scaleToRatiow) {
     
      Canvas canvasTmp = Canvas.createIfSupported();
      Context2d context = canvasTmp.getContext2d();

      double ch = (image.getHeight() * scaleToRatioh);// + 100;
      double cw = (image.getWidth() * scaleToRatiow); //+ 100;

      canvasTmp.setCoordinateSpaceHeight((int) ch);
      canvasTmp.setCoordinateSpaceWidth((int) cw);
     
      ImageElement imageElement = ImageElement.as(image.getElement());
    
      // s = source
      // d = destination
View Full Code Here

TOP

Related Classes of com.google.gwt.canvas.client.Canvas

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.