javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/HTML5GraphicsEnvironment.java
branchcanvas
changeset 1158 633572e14095
parent 1151 d6047ef47a68
child 1267 0f775bd8d210
     1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/HTML5GraphicsEnvironment.java	Mon May 27 10:19:36 2013 +0200
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/HTML5GraphicsEnvironment.java	Mon May 27 14:13:01 2013 +0200
     1.3 @@ -174,13 +174,13 @@
     1.4          return drawImageImpl(context, nativeImage, sx, sy, sWidth, sHeight, x, y, width, height);
     1.5      }
     1.6  
     1.7 -    @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "ctx.drawImage(img,x,y,width,height); return img;")
     1.8 +    @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "img.onload=function(){ctx.drawImage(img,x,y,width,height);};ctx.drawImage(img,x,y,width,height); return img;")
     1.9      private native static Object drawImageImpl(Object ctx, Object img, double x, double y, double width, double height);
    1.10  
    1.11 -    @JavaScriptBody(args = {"ctx", "img", "sx", "sy", "swidth", "sheight", "x", "y", "width", "height"}, body = "ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height); return img;")
    1.12 +    @JavaScriptBody(args = {"ctx", "img", "sx", "sy", "swidth", "sheight", "x", "y", "width", "height"}, body = "img.onload=function(){ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);}; ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height); return img;")
    1.13      private native static Object drawImageImpl(Object ctx, Object img, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height);
    1.14  
    1.15 -    @JavaScriptBody(args = {"ctx", "img", "x", "y"}, body = "ctx.drawImage(img,x,y); return img;")
    1.16 +    @JavaScriptBody(args = {"ctx", "img", "x", "y"}, body = "img.onload=function(){ctx.drawImage(img,x,y);}; ctx.drawImage(img,x,y); return img;")
    1.17      private native static Object drawImageImpl(Object ctx, Object img, double x, double y);
    1.18  
    1.19      public Object setFillStyle(Style style, Object nativeStyle) {
    1.20 @@ -233,7 +233,7 @@
    1.21              "gradient.addColorStop(position,color)")
    1.22      private static native void addColorStopImpl(Object gradient, double position, String color);
    1.23  
    1.24 -    @JavaScriptBody(args = {"context", "obj"}, body = "context.fillStyle=obj;")
    1.25 +    @JavaScriptBody(args = {"context", "obj"}, body = "console.log('style: '+obj);context.fillStyle=obj;")
    1.26      private native void setFillStyleImpl(Object context, Object obj);
    1.27  
    1.28      @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
    1.29 @@ -448,8 +448,8 @@
    1.30      @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
    1.31      private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1);
    1.32  
    1.33 -    @JavaScriptBody(args = {"path"}, body = "var b = new Image(); b.src=path; return b;")
    1.34 -    public native Image getImageForPath(String path);
    1.35 +//    @JavaScriptBody(args = {"path"}, body = "var b = new Image(); b.src=path; return b;")
    1.36 +//    public native Image getImageForPathImpl(String path);
    1.37  
    1.38      @Override
    1.39      public int getHeight() {