javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java
branchcanvas
changeset 1144 5bf850c5b7f1
parent 1141 69c81bdaf193
child 1150 42e29ceb8371
     1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Fri May 24 12:29:58 2013 +0200
     1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Mon May 27 08:30:18 2013 +0200
     1.3 @@ -132,17 +132,20 @@
     1.4          graphicsEnvironmentImpl.scale(x, y);
     1.5      }
     1.6  
     1.7 -////    public void drawImage(ImageData image, double x, double y){
     1.8 -////        graphicsEnvironmentImpl.drawImage(image, x, y);
     1.9 -////    }
    1.10 -////
    1.11 -////    public void drawImage(ImageData image, double x, double y, double width, double height){
    1.12 -////        graphicsEnvironmentImpl.drawImage(image, x, y, width, height);
    1.13 -////    }
    1.14 -////
    1.15 -////    public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){
    1.16 -////        graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height);
    1.17 -////    }
    1.18 +    public void paintImage(Image image, double x, double y){
    1.19 +        Object nativeImage = graphicsEnvironmentImpl.drawImage(image, x, y, image.getCached());
    1.20 +        image.cache(nativeImage);
    1.21 +    }
    1.22 +
    1.23 +    public void paintImage(Image image, double x, double y, double width, double height){
    1.24 +        Object nativeImage = graphicsEnvironmentImpl.drawImage(image, x, y, width, height, image.getCached());
    1.25 +        image.cache(nativeImage);
    1.26 +    }
    1.27 +
    1.28 +    public void paintImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){
    1.29 +        Object nativeImage = graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height, image.getCached());
    1.30 +        image.cache(nativeImage);
    1.31 +    }
    1.32  
    1.33      public void setShadowColor(String color){
    1.34          graphicsEnvironmentImpl.setShadowColor(color);
    1.35 @@ -262,25 +265,25 @@
    1.36          graphicsEnvironmentImpl.strokeText(text, x, y, maxWidth);
    1.37      }
    1.38  
    1.39 -////    public ImageData createImageData(double x, double y){
    1.40 -////        return graphicsEnvironmentImpl.createImageData(x, y);
    1.41 -////    }
    1.42 -////
    1.43 -////    public ImageData createImageData(ImageData imageData){
    1.44 -////        return graphicsEnvironmentImpl.createImageData(imageData);
    1.45 -////    }
    1.46 -////
    1.47 -////    public ImageData getImageData(double x, double y, double width, double height){
    1.48 -////        return graphicsEnvironmentImpl.getImageData(x, y, width, height);
    1.49 -////    }
    1.50 -////
    1.51 -////    public void putImageData(ImageData imageData, double x, double y){
    1.52 -////        graphicsEnvironmentImpl.putImageData(imageData, x, y);
    1.53 -////    }
    1.54 -////
    1.55 -////    public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight){
    1.56 -////        graphicsEnvironmentImpl.putImageData(imageData, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
    1.57 -////    }
    1.58 +    public ImageData createPixelMap(double x, double y){
    1.59 +        return graphicsEnvironmentImpl.createPixelMap(x, y);
    1.60 +    }
    1.61 +
    1.62 +    public ImageData createPixelMap(ImageData pixelMap){
    1.63 +        return graphicsEnvironmentImpl.createPixelMap(pixelMap);
    1.64 +    }
    1.65 +
    1.66 +    public ImageData getSnapshot(double x, double y, double width, double height){
    1.67 +        return graphicsEnvironmentImpl.getPixelMap(x, y, width, height);
    1.68 +    }
    1.69 +
    1.70 +    public void paintPixelMap(ImageData pixelMap, double x, double y){
    1.71 +        graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y);
    1.72 +    }
    1.73 +
    1.74 +    public void paintPixelMap(ImageData pixelMap, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight){
    1.75 +        graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
    1.76 +    }
    1.77  
    1.78      public void setGlobalAlpha(double alpha){
    1.79          graphicsEnvironmentImpl.setGlobalAlpha(alpha);
    1.80 @@ -302,17 +305,17 @@
    1.81          return new LinearGradient(x0, y0, x1, y1);
    1.82      }
    1.83  
    1.84 -////    public Pattern createPattern(ImageData image, String repeat){
    1.85 -////        return new Pattern(image, repeat);
    1.86 -////    }
    1.87 +    public Pattern createPattern(Image image, String repeat){
    1.88 +        return new Pattern(image, repeat);
    1.89 +    }
    1.90  
    1.91      public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1){
    1.92          return new RadialGradient(x0, y0, r0, x1, y1, r1);
    1.93      }
    1.94  
    1.95 -////    public ImageData getImageDataForPath(String path){
    1.96 -////        return graphicsEnvironmentImpl.getImageForPath(path);
    1.97 -////    }
    1.98 +    public Image getImageForPath(String path){
    1.99 +        return graphicsEnvironmentImpl.getImageForPath(path);
   1.100 +    }
   1.101  
   1.102      public int getHeight(){
   1.103          return graphicsEnvironmentImpl.getHeight();